diff --git a/manager/config-validator.cpp b/manager/config-validator.cpp
new file mode 100644
index 0000000..05b0157
--- /dev/null
+++ b/manager/config-validator.cpp
@@ -0,0 +1,177 @@
+#include "config-validator.hpp"
+
+#include "grouplayout.hpp"
+#include "ledlayout.hpp"
+
+#include <phosphor-logging/lg2.hpp>
+#include <sdbusplus/bus.hpp>
+
+using namespace phosphor::led;
+
+namespace phosphor
+{
+namespace led
+{
+
+// Priority for a particular LED needs to stay SAME across all groups
+using PriorityMap =
+    std::unordered_map<std::string,
+                       std::optional<phosphor::led::Layout::Action>>;
+
+static bool isUsingGroupPriority(const phosphor::led::GroupMap& ledMap)
+{
+    for (const auto& [_, group] : ledMap)
+    {
+        if (group.priority != 0)
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
+static std::string priorityToString(
+    const std::optional<phosphor::led::Layout::Action>& priority)
+{
+    if (!priority.has_value())
+    {
+        return "none";
+    }
+    switch (priority.value())
+    {
+        case phosphor::led::Layout::Action::Off:
+            return "Off";
+        case phosphor::led::Layout::Action::On:
+            return "On";
+        case phosphor::led::Layout::Action::Blink:
+            return "Blink";
+    }
+    return "?";
+}
+
+/** @brief Validate the Priority of an LED is same across ALL groups
+ *
+ *  @param[in] name - led name member of each group
+ *  @param[in] priority - member priority of each group
+ *  @param[out] priorityMap - std::unordered_map, key:name, value:priority
+ *
+ *  @return
+ */
+void validatePriority(
+    const std::string& name,
+    const std::optional<phosphor::led::Layout::Action>& priority,
+    PriorityMap& priorityMap)
+{
+    auto iter = priorityMap.find(name);
+    if (iter == priorityMap.end())
+    {
+        priorityMap.emplace(name, priority);
+        return;
+    }
+
+    if (iter->second != priority)
+    {
+        throw ConfigValidationException(
+            error::LedPriorityMismatch, "?", name,
+            "Priority of the LED is not same across groups. Old Priority = " +
+                priorityToString(iter->second) +
+                ", New Priority = " + priorityToString(priority));
+    }
+}
+
+static void validateConfigV1GroupForLedPriority(
+    const std::string groupName,
+    const phosphor::led::Layout::GroupLayout& group, PriorityMap& priorityMap)
+{
+    if (group.priority != 0)
+    {
+        throw ConfigValidationException(
+            error::MixedLedAndGroupPriority, groupName,
+            "Cannot mix group priority and led priority");
+    }
+
+    for (const auto& ledAction : group.actionSet)
+    {
+        if (ledAction.priority == std::nullopt)
+        {
+            throw ConfigValidationException(error::MissingLedPriority,
+                                            groupName, ledAction.name,
+                                            "Need valid led priority");
+        }
+
+        // Same LEDs can be part of multiple groups. However, their
+        // priorities across groups need to match.
+        validatePriority(ledAction.name, ledAction.priority, priorityMap);
+    }
+}
+
+static void
+    validateConfigV1ForLedPriority(const phosphor::led::GroupMap& ledMap)
+{
+    PriorityMap priorityMap{};
+    for (const auto& [groupName, group] : ledMap)
+    {
+        validateConfigV1GroupForLedPriority(groupName, group, priorityMap);
+    }
+}
+
+static void validateConfigV1GroupForGroupPriority(
+    const std::string groupName,
+    const phosphor::led::Layout::GroupLayout& group)
+{
+    for (const auto& led : group.actionSet)
+    {
+        if (led.priority != std::nullopt)
+        {
+            throw ConfigValidationException(
+                error::MixedLedAndGroupPriority, groupName, led.name,
+                "Cannot mix group priority and led priority for LED");
+        }
+    }
+
+    if (group.priority == 0)
+    {
+        // group priority 0 is for internal use
+        throw ConfigValidationException(error::InvalidGroupPriority, groupName,
+                                        "Group Priority cannot be 0");
+    }
+}
+
+static void
+    validateConfigV1ForGroupPriority(const phosphor::led::GroupMap& ledMap)
+{
+    std::set<int> groupPriorities;
+    for (const auto& [_, group] : ledMap)
+    {
+        groupPriorities.insert(group.priority);
+    }
+
+    if (groupPriorities.size() != ledMap.size())
+    {
+        throw ConfigValidationException(
+            error::DuplicateGroupPriority,
+            "When using Group Priority, no 2 Groups may have the same priority");
+    }
+
+    for (const auto& [groupName, group] : ledMap)
+    {
+        validateConfigV1GroupForGroupPriority(groupName, group);
+    }
+}
+
+void validateConfigV1(const GroupMap& ledMap)
+{
+    const bool useGroupPriority = isUsingGroupPriority(ledMap);
+
+    if (useGroupPriority)
+    {
+        validateConfigV1ForGroupPriority(ledMap);
+    }
+    else
+    {
+        validateConfigV1ForLedPriority(ledMap);
+    }
+}
+
+} // namespace led
+} // namespace phosphor
diff --git a/manager/config-validator.hpp b/manager/config-validator.hpp
new file mode 100644
index 0000000..5d9ff5f
--- /dev/null
+++ b/manager/config-validator.hpp
@@ -0,0 +1,68 @@
+#include "grouplayout.hpp"
+#include "ledlayout.hpp"
+
+#include <phosphor-logging/lg2.hpp>
+#include <sdbusplus/bus.hpp>
+
+namespace phosphor
+{
+namespace led
+{
+namespace error
+{
+enum ConfigValidationError
+{
+    // An LED has different priorities assigned to it in different groups
+    LedPriorityMismatch,
+
+    // LED priority was needed but not assigned
+    MissingLedPriority,
+
+    // Mixup of the 2 configuration options
+    MixedLedAndGroupPriority,
+
+    // An invalid group priority was assigned
+    InvalidGroupPriority,
+
+    // Group priorities were not unique
+    DuplicateGroupPriority,
+};
+}
+
+class ConfigValidationException : std::runtime_error
+{
+  public:
+    error::ConfigValidationError reason;
+
+    ConfigValidationException(const error::ConfigValidationError& err,
+                              const std::string& msg) :
+        std::runtime_error(msg), reason(err)
+    {
+        lg2::error(msg.c_str());
+    }
+
+    ConfigValidationException(const error::ConfigValidationError& err,
+                              const std::string& groupName,
+                              const std::string& msg) :
+        std::runtime_error(msg), reason(err)
+    {
+        lg2::error("Configuration Validation Error in Group {GROUP}: {MSG}",
+                   "GROUP", groupName, "MSG", msg.c_str());
+    }
+
+    ConfigValidationException(const error::ConfigValidationError& err,
+                              const std::string& groupName,
+                              const std::string& ledName,
+                              const std::string& msg) :
+        std::runtime_error(msg), reason(err)
+    {
+        lg2::error(
+            "Configuration Validation Error in Group {GROUP}, Led {LED}: {MSG}",
+            "GROUP", groupName, "LED", ledName, "MSG", msg.c_str());
+    }
+};
+
+void validateConfigV1(const phosphor::led::GroupMap& ledMap);
+
+} // namespace led
+} // namespace phosphor
diff --git a/manager/json-parser.hpp b/manager/json-parser.hpp
index 8f2832b..30a06a4 100644
--- a/manager/json-parser.hpp
+++ b/manager/json-parser.hpp
@@ -1,5 +1,6 @@
 #include "config.h"
 
+#include "config-validator.hpp"
 #include "grouplayout.hpp"
 #include "json-config.hpp"
 #include "ledlayout.hpp"
@@ -76,59 +77,7 @@
     return phosphor::led::Layout::Action::Blink;
 }
 
-static std::string priorityToString(
-    const std::optional<phosphor::led::Layout::Action>& priority)
-{
-    if (!priority.has_value())
-    {
-        return "none";
-    }
-    switch (priority.value())
-    {
-        case phosphor::led::Layout::Action::Off:
-            return "Off";
-        case phosphor::led::Layout::Action::On:
-            return "On";
-        case phosphor::led::Layout::Action::Blink:
-            return "Blink";
-    }
-    return "?";
-}
-
-/** @brief Validate the Priority of an LED is same across ALL groups
- *
- *  @param[in] name - led name member of each group
- *  @param[in] priority - member priority of each group
- *  @param[out] priorityMap - std::unordered_map, key:name, value:priority
- *
- *  @return
- */
-void validatePriority(
-    const std::string& name,
-    const std::optional<phosphor::led::Layout::Action>& priority,
-    PriorityMap& priorityMap)
-{
-    auto iter = priorityMap.find(name);
-    if (iter == priorityMap.end())
-    {
-        priorityMap.emplace(name, priority);
-        return;
-    }
-
-    if (iter->second != priority)
-    {
-        lg2::error(
-            "Priority of LED is not same across all, Name = {NAME}, Old Priority = {OLD_PRIO}, New Priority = {NEW_PRIO}",
-            "NAME", name, "OLD_PRIO", priorityToString(iter->second),
-            "NEW_PRIO", priorityToString(priority));
-
-        throw std::runtime_error(
-            "Priority of at least one LED is not same across groups");
-    }
-}
-
 static void loadJsonConfigV1GroupMember(const Json& member,
-                                        PriorityMap& priorityMap,
                                         phosphor::led::ActionSet& ledActions)
 {
     auto name = member.value("Name", "");
@@ -144,18 +93,13 @@
         priority = getAction(priorityStr);
     }
 
-    // Same LEDs can be part of multiple groups. However, their
-    // priorities across groups need to match.
-    validatePriority(name, priority, priorityMap);
-
     phosphor::led::Layout::LedAction ledAction{name, action, dutyOn, period,
                                                priority};
     ledActions.emplace(ledAction);
 }
 
 static void loadJsonConfigV1Group(const Json& entry,
-                                  phosphor::led::GroupMap& ledMap,
-                                  PriorityMap& priorityMap)
+                                  phosphor::led::GroupMap& ledMap)
 {
     const Json empty{};
 
@@ -166,15 +110,16 @@
     tmpPath /= groupName;
     auto objpath = tmpPath.string();
     auto members = entry.value("members", empty);
-    int priority = entry.value("Priority", 0);
 
     lg2::debug("config for '{GROUP}'", "GROUP", groupName);
 
+    int priority = entry.value("Priority", 0);
+
     phosphor::led::ActionSet ledActions{};
     phosphor::led::Layout::GroupLayout groupLayout{};
     for (const auto& member : members)
     {
-        loadJsonConfigV1GroupMember(member, priorityMap, ledActions);
+        loadJsonConfigV1GroupMember(member, ledActions);
     }
 
     // Generated an std::unordered_map of LedGroupNames to std::set of LEDs
@@ -192,7 +137,6 @@
 const phosphor::led::GroupMap loadJsonConfigV1(const Json& json)
 {
     phosphor::led::GroupMap ledMap{};
-    PriorityMap priorityMap{};
 
     // define the default JSON as empty
     const Json empty{};
@@ -200,7 +144,7 @@
 
     for (const auto& entry : leds)
     {
-        loadJsonConfigV1Group(entry, ledMap, priorityMap);
+        loadJsonConfigV1Group(entry, ledMap);
     }
 
     return ledMap;
diff --git a/manager/led-main.cpp b/manager/led-main.cpp
index a18c793..6d1ef82 100644
--- a/manager/led-main.cpp
+++ b/manager/led-main.cpp
@@ -42,6 +42,8 @@
     auto systemLedMap = getSystemLedMap(configFile);
 #endif
 
+    phosphor::led::validateConfigV1(systemLedMap);
+
     /** @brief Group manager object */
     phosphor::led::Manager manager(bus, systemLedMap, event);
 
diff --git a/manager/meson.build b/manager/meson.build
index e2452bd..0c97649 100644
--- a/manager/meson.build
+++ b/manager/meson.build
@@ -4,6 +4,7 @@
     'manager.cpp',
     'serialize.cpp',
     '../utils.cpp',
+    'config-validator.cpp',
 ]
 
 if get_option('use-json').disabled()
