diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index c7aeb86..7dfe62d 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -19,7 +19,6 @@
 #include <source_location>
 #include <string>
 #include <string_view>
-#include <utility>
 
 // IWYU pragma: no_forward_declare crow::Response
 
@@ -38,137 +37,47 @@
 void moveErrorsToErrorJson(nlohmann::json& target, nlohmann::json& source);
 
 /**
- * @brief Formats ResourceInUse message into JSON
- * Message body: "The change to the requested resource failed because the
- * resource is in use or in transition."
+ * @brief Formats Success message into JSON
+ * Message body: "The request completed successfully."
  *
  *
- * @returns Message ResourceInUse formatted to JSON */
-nlohmann::json resourceInUse();
+ * @returns Message Success formatted to JSON */
+nlohmann::json success();
 
-void resourceInUse(crow::Response& res);
+void success(crow::Response& res);
 
 /**
- * @brief Formats MalformedJSON message into JSON
- * Message body: "The request body submitted was malformed JSON and could not be
- * parsed by the receiving service."
+ * @brief Formats GeneralError message into JSON
+ * Message body: "A general error has occurred.  See Resolution for information
+ * on how to resolve the error, or @Message.ExtendedInfo if Resolution is not
+ * provided."
  *
  *
- * @returns Message MalformedJSON formatted to JSON */
-nlohmann::json malformedJSON();
+ * @returns Message GeneralError formatted to JSON */
+nlohmann::json generalError();
 
-void malformedJSON(crow::Response& res);
+void generalError(crow::Response& res);
 
 /**
- * @brief Formats ResourceMissingAtURI message into JSON
- * Message body: "The resource at the URI <arg1> was not found."
+ * @brief Formats Created message into JSON
+ * Message body: "The resource was created successfully."
  *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
  *
- * @returns Message ResourceMissingAtURI formatted to JSON */
-nlohmann::json resourceMissingAtURI(const boost::urls::url_view_base& arg1);
+ * @returns Message Created formatted to JSON */
+nlohmann::json created();
 
-void resourceMissingAtURI(crow::Response& res,
-                          const boost::urls::url_view_base& arg1);
+void created(crow::Response& res);
 
 /**
- * @brief Formats ActionParameterValueFormatError message into JSON
- * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3>
- * is not a format that the parameter can accept."
+ * @brief Formats NoOperation message into JSON
+ * Message body: "The request body submitted contain no data to act upon and no
+ * changes to the resource took place."
  *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- * @param[in] arg3 Parameter of message that will replace %3 in its body.
  *
- * @returns Message ActionParameterValueFormatError formatted to JSON */
-nlohmann::json actionParameterValueFormatError(
-    const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3);
+ * @returns Message NoOperation formatted to JSON */
+nlohmann::json noOperation();
 
-void actionParameterValueFormatError(
-    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2,
-    std::string_view arg3);
-
-/**
- * @brief Formats ActionParameterValueNotInList message into JSON
- * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3>
- * is not in the list of acceptable values."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- * @param[in] arg3 Parameter of message that will replace %3 in its body.
- *
- * @returns Message ActionParameterValueNotInList formatted to JSON */
-nlohmann::json actionParameterValueNotInList(
-    std::string_view arg1, std::string_view arg2, std::string_view arg3);
-
-void actionParameterValueNotInList(crow::Response& res, std::string_view arg1,
-                                   std::string_view arg2,
-                                   std::string_view arg3);
-
-/**
- * @brief Formats InternalError message into JSON
- * Message body: "The request failed due to an internal service error.  The
- * service is still operational."
- *
- *
- * @returns Message InternalError formatted to JSON */
-nlohmann::json internalError();
-
-void internalError(crow::Response& res, std::source_location location =
-                                            std::source_location::current());
-
-/**
- * @brief Formats UnrecognizedRequestBody message into JSON
- * Message body: "The service detected a malformed request body that it was
- * unable to interpret."
- *
- *
- * @returns Message UnrecognizedRequestBody formatted to JSON */
-nlohmann::json unrecognizedRequestBody();
-
-void unrecognizedRequestBody(crow::Response& res);
-
-/**
- * @brief Formats ResourceAtUriUnauthorized message into JSON
- * Message body: "While accessing the resource at <arg1>, the service received
- * an authorization error <arg2>."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message ResourceAtUriUnauthorized formatted to JSON */
-nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view_base& arg1,
-                                         std::string_view arg2);
-
-void resourceAtUriUnauthorized(crow::Response& res,
-                               const boost::urls::url_view_base& arg1,
-                               std::string_view arg2);
-
-/**
- * @brief Formats ActionParameterUnknown message into JSON
- * Message body: "The action <arg1> was submitted with the invalid parameter
- * <arg2>."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message ActionParameterUnknown formatted to JSON */
-nlohmann::json actionParameterUnknown(std::string_view arg1,
-                                      std::string_view arg2);
-
-void actionParameterUnknown(crow::Response& res, std::string_view arg1,
-                            std::string_view arg2);
-
-/**
- * @brief Formats ResourceCannotBeDeleted message into JSON
- * Message body: "The delete request failed because the resource requested
- * cannot be deleted."
- *
- *
- * @returns Message ResourceCannotBeDeleted formatted to JSON */
-nlohmann::json resourceCannotBeDeleted();
-
-void resourceCannotBeDeleted(crow::Response& res);
+void noOperation(crow::Response& res);
 
 /**
  * @brief Formats PropertyDuplicate message into JSON
@@ -182,56 +91,31 @@
 void propertyDuplicate(crow::Response& res, std::string_view arg1);
 
 /**
- * @brief Formats ServiceTemporarilyUnavailable message into JSON
- * Message body: "The service is temporarily unavailable.  Retry in <arg1>
- * seconds."
+ * @brief Formats PropertyUnknown message into JSON
+ * Message body: "The property <arg1> is not in the list of valid properties for
+ * the resource."
  *
  * @param[in] arg1 Parameter of message that will replace %1 in its body.
  *
- * @returns Message ServiceTemporarilyUnavailable formatted to JSON */
-nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1);
+ * @returns Message PropertyUnknown formatted to JSON */
+nlohmann::json propertyUnknown(std::string_view arg1);
 
-void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1);
+void propertyUnknown(crow::Response& res, std::string_view arg1);
 
 /**
- * @brief Formats ResourceAlreadyExists message into JSON
- * Message body: "The requested resource of type <arg1> with the property <arg2>
- * with the value <arg3> already exists."
+ * @brief Formats PropertyValueTypeError message into JSON
+ * Message body: "The value <arg1> for the property <arg2> is not a type that
+ * the property can accept."
  *
  * @param[in] arg1 Parameter of message that will replace %1 in its body.
  * @param[in] arg2 Parameter of message that will replace %2 in its body.
- * @param[in] arg3 Parameter of message that will replace %3 in its body.
  *
- * @returns Message ResourceAlreadyExists formatted to JSON */
-nlohmann::json resourceAlreadyExists(
-    std::string_view arg1, std::string_view arg2, std::string_view arg3);
+ * @returns Message PropertyValueTypeError formatted to JSON */
+nlohmann::json propertyValueTypeError(const nlohmann::json& arg1,
+                                      std::string_view arg2);
 
-void resourceAlreadyExists(crow::Response& res, std::string_view arg1,
-                           std::string_view arg2, std::string_view arg3);
-
-/**
- * @brief Formats AccountForSessionNoLongerExists message into JSON
- * Message body: "The account for the current session was removed, and so the
- * current session was removed as well."
- *
- *
- * @returns Message AccountForSessionNoLongerExists formatted to JSON */
-nlohmann::json accountForSessionNoLongerExists();
-
-void accountForSessionNoLongerExists(crow::Response& res);
-
-/**
- * @brief Formats CreateFailedMissingReqProperties message into JSON
- * Message body: "The create operation failed because the required property
- * <arg1> was missing from the request."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message CreateFailedMissingReqProperties formatted to JSON */
-nlohmann::json createFailedMissingReqProperties(std::string_view arg1);
-
-void createFailedMissingReqProperties(crow::Response& res,
-                                      std::string_view arg1);
+void propertyValueTypeError(crow::Response& res, const nlohmann::json& arg1,
+                            std::string_view arg2);
 
 /**
  * @brief Formats PropertyValueFormatError message into JSON
@@ -279,52 +163,96 @@
                              std::string_view arg2);
 
 /**
- * @brief Formats ResourceAtUriInUnknownFormat message into JSON
- * Message body: "The resource at <arg1> is in a format not recognized by the
- * service."
+ * @brief Formats PropertyValueError message into JSON
+ * Message body: "The value provided for the property <arg1> is not valid."
  *
  * @param[in] arg1 Parameter of message that will replace %1 in its body.
  *
- * @returns Message ResourceAtUriInUnknownFormat formatted to JSON */
-nlohmann::json
-    resourceAtUriInUnknownFormat(const boost::urls::url_view_base& arg1);
+ * @returns Message PropertyValueError formatted to JSON */
+nlohmann::json propertyValueError(std::string_view arg1);
 
-void resourceAtUriInUnknownFormat(crow::Response& res,
-                                  const boost::urls::url_view_base& arg1);
+void propertyValueError(crow::Response& res, std::string_view arg1);
 
 /**
- * @brief Formats ServiceDisabled message into JSON
- * Message body: "The operation failed because the service at <arg1> is disabled
- * and cannot accept requests."
+ * @brief Formats PropertyNotWritable message into JSON
+ * Message body: "The property <arg1> is a read-only property and cannot be
+ * assigned a value."
  *
  * @param[in] arg1 Parameter of message that will replace %1 in its body.
  *
- * @returns Message ServiceDisabled formatted to JSON */
-nlohmann::json serviceDisabled(std::string_view arg1);
+ * @returns Message PropertyNotWritable formatted to JSON */
+nlohmann::json propertyNotWritable(std::string_view arg1);
 
-void serviceDisabled(crow::Response& res, std::string_view arg1);
+void propertyNotWritable(crow::Response& res, std::string_view arg1);
 
 /**
- * @brief Formats ServiceInUnknownState message into JSON
- * Message body: "The operation failed because the service is in an unknown
- * state and can no longer take incoming requests."
+ * @brief Formats PropertyNotUpdated message into JSON
+ * Message body: "The property <arg1> was not updated due to an internal service
+ * error.  The service is still operational."
  *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
  *
- * @returns Message ServiceInUnknownState formatted to JSON */
-nlohmann::json serviceInUnknownState();
+ * @returns Message PropertyNotUpdated formatted to JSON */
+nlohmann::json propertyNotUpdated(std::string_view arg1);
 
-void serviceInUnknownState(crow::Response& res);
+void propertyNotUpdated(crow::Response& res, std::string_view arg1);
 
 /**
- * @brief Formats EventSubscriptionLimitExceeded message into JSON
- * Message body: "The event subscription failed due to the number of
- * simultaneous subscriptions exceeding the limit of the implementation."
+ * @brief Formats PropertyMissing message into JSON
+ * Message body: "The property <arg1> is a required property and must be
+ * included in the request."
  *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
  *
- * @returns Message EventSubscriptionLimitExceeded formatted to JSON */
-nlohmann::json eventSubscriptionLimitExceeded();
+ * @returns Message PropertyMissing formatted to JSON */
+nlohmann::json propertyMissing(std::string_view arg1);
 
-void eventSubscriptionLimitExceeded(crow::Response& res);
+void propertyMissing(crow::Response& res, std::string_view arg1);
+
+/**
+ * @brief Formats MalformedJSON message into JSON
+ * Message body: "The request body submitted was malformed JSON and could not be
+ * parsed by the receiving service."
+ *
+ *
+ * @returns Message MalformedJSON formatted to JSON */
+nlohmann::json malformedJSON();
+
+void malformedJSON(crow::Response& res);
+
+/**
+ * @brief Formats InvalidJSON message into JSON
+ * Message body: "The request body submitted is invalid JSON starting at line
+ * <arg1> and could not be parsed by the receiving service."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message InvalidJSON formatted to JSON */
+nlohmann::json invalidJSON(std::string_view arg1);
+
+void invalidJSON(crow::Response& res, std::string_view arg1);
+
+/**
+ * @brief Formats EmptyJSON message into JSON
+ * Message body: "The request body submitted contained an empty JSON object and
+ * the service is unable to process it."
+ *
+ *
+ * @returns Message EmptyJSON formatted to JSON */
+nlohmann::json emptyJSON();
+
+void emptyJSON(crow::Response& res);
+
+/**
+ * @brief Formats ActionNotSupported message into JSON
+ * Message body: "The action <arg1> is not supported by the resource."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message ActionNotSupported formatted to JSON */
+nlohmann::json actionNotSupported(std::string_view arg1);
+
+void actionNotSupported(crow::Response& res, std::string_view arg1);
 
 /**
  * @brief Formats ActionParameterMissing message into JSON
@@ -342,6 +270,678 @@
                             std::string_view arg2);
 
 /**
+ * @brief Formats ActionParameterDuplicate message into JSON
+ * Message body: "The action <arg1> was submitted with more than one value for
+ * the parameter <arg2>."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message ActionParameterDuplicate formatted to JSON */
+nlohmann::json actionParameterDuplicate(std::string_view arg1,
+                                        std::string_view arg2);
+
+void actionParameterDuplicate(crow::Response& res, std::string_view arg1,
+                              std::string_view arg2);
+
+/**
+ * @brief Formats ActionParameterUnknown message into JSON
+ * Message body: "The action <arg1> was submitted with the invalid parameter
+ * <arg2>."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message ActionParameterUnknown formatted to JSON */
+nlohmann::json actionParameterUnknown(std::string_view arg1,
+                                      std::string_view arg2);
+
+void actionParameterUnknown(crow::Response& res, std::string_view arg1,
+                            std::string_view arg2);
+
+/**
+ * @brief Formats ActionParameterValueTypeError message into JSON
+ * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3>
+ * is not a type that the parameter can accept."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ * @param[in] arg3 Parameter of message that will replace %3 in its body.
+ *
+ * @returns Message ActionParameterValueTypeError formatted to JSON */
+nlohmann::json actionParameterValueTypeError(
+    const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3);
+
+void actionParameterValueTypeError(
+    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2,
+    std::string_view arg3);
+
+/**
+ * @brief Formats ActionParameterValueFormatError message into JSON
+ * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3>
+ * is not a format that the parameter can accept."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ * @param[in] arg3 Parameter of message that will replace %3 in its body.
+ *
+ * @returns Message ActionParameterValueFormatError formatted to JSON */
+nlohmann::json actionParameterValueFormatError(
+    const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3);
+
+void actionParameterValueFormatError(
+    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2,
+    std::string_view arg3);
+
+/**
+ * @brief Formats ActionParameterValueNotInList message into JSON
+ * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3>
+ * is not in the list of acceptable values."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ * @param[in] arg3 Parameter of message that will replace %3 in its body.
+ *
+ * @returns Message ActionParameterValueNotInList formatted to JSON */
+nlohmann::json actionParameterValueNotInList(
+    std::string_view arg1, std::string_view arg2, std::string_view arg3);
+
+void actionParameterValueNotInList(crow::Response& res, std::string_view arg1,
+                                   std::string_view arg2,
+                                   std::string_view arg3);
+
+/**
+ * @brief Formats ActionParameterValueOutOfRange message into JSON
+ * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3>
+ * is not in the supported range of acceptable values."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ * @param[in] arg3 Parameter of message that will replace %3 in its body.
+ *
+ * @returns Message ActionParameterValueOutOfRange formatted to JSON */
+nlohmann::json actionParameterValueOutOfRange(
+    std::string_view arg1, std::string_view arg2, std::string_view arg3);
+
+void actionParameterValueOutOfRange(crow::Response& res, std::string_view arg1,
+                                    std::string_view arg2,
+                                    std::string_view arg3);
+
+/**
+ * @brief Formats ActionParameterValueError message into JSON
+ * Message body: "The value for the parameter <arg1> in the action <arg2> is
+ * invalid."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message ActionParameterValueError formatted to JSON */
+nlohmann::json actionParameterValueError(const nlohmann::json& arg1,
+                                         std::string_view arg2);
+
+void actionParameterValueError(crow::Response& res, const nlohmann::json& arg1,
+                               std::string_view arg2);
+
+/**
+ * @brief Formats ActionParameterNotSupported message into JSON
+ * Message body: "The parameter <arg1> for the action <arg2> is not supported on
+ * the target resource."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message ActionParameterNotSupported formatted to JSON */
+nlohmann::json actionParameterNotSupported(std::string_view arg1,
+                                           std::string_view arg2);
+
+void actionParameterNotSupported(crow::Response& res, std::string_view arg1,
+                                 std::string_view arg2);
+
+/**
+ * @brief Formats ArraySizeTooLong message into JSON
+ * Message body: "The array provided for property <arg1> exceeds the size limit
+ * <arg2>."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message ArraySizeTooLong formatted to JSON */
+nlohmann::json arraySizeTooLong(std::string_view arg1, uint64_t arg2);
+
+void arraySizeTooLong(crow::Response& res, std::string_view arg1,
+                      uint64_t arg2);
+
+/**
+ * @brief Formats ArraySizeTooShort message into JSON
+ * Message body: "The array provided for property <arg1> is under the minimum
+ * size limit <arg2>."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message ArraySizeTooShort formatted to JSON */
+nlohmann::json arraySizeTooShort(std::string_view arg1, std::string_view arg2);
+
+void arraySizeTooShort(crow::Response& res, std::string_view arg1,
+                       std::string_view arg2);
+
+/**
+ * @brief Formats QueryParameterValueTypeError message into JSON
+ * Message body: "The value <arg1> for the query parameter <arg2> is not a type
+ * that the parameter can accept."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message QueryParameterValueTypeError formatted to JSON */
+nlohmann::json queryParameterValueTypeError(const nlohmann::json& arg1,
+                                            std::string_view arg2);
+
+void queryParameterValueTypeError(
+    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2);
+
+/**
+ * @brief Formats QueryParameterValueFormatError message into JSON
+ * Message body: "The value <arg1> for the parameter <arg2> is not a format that
+ * the parameter can accept."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message QueryParameterValueFormatError formatted to JSON */
+nlohmann::json queryParameterValueFormatError(const nlohmann::json& arg1,
+                                              std::string_view arg2);
+
+void queryParameterValueFormatError(
+    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2);
+
+/**
+ * @brief Formats QueryParameterValueError message into JSON
+ * Message body: "The value for the parameter <arg1> is invalid."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message QueryParameterValueError formatted to JSON */
+nlohmann::json queryParameterValueError(std::string_view arg1);
+
+void queryParameterValueError(crow::Response& res, std::string_view arg1);
+
+/**
+ * @brief Formats QueryParameterOutOfRange message into JSON
+ * Message body: "The value <arg1> for the query parameter <arg2> is out of
+ * range <arg3>."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ * @param[in] arg3 Parameter of message that will replace %3 in its body.
+ *
+ * @returns Message QueryParameterOutOfRange formatted to JSON */
+nlohmann::json queryParameterOutOfRange(
+    std::string_view arg1, std::string_view arg2, std::string_view arg3);
+
+void queryParameterOutOfRange(crow::Response& res, std::string_view arg1,
+                              std::string_view arg2, std::string_view arg3);
+
+/**
+ * @brief Formats QueryNotSupportedOnResource message into JSON
+ * Message body: "Querying is not supported on the requested resource."
+ *
+ *
+ * @returns Message QueryNotSupportedOnResource formatted to JSON */
+nlohmann::json queryNotSupportedOnResource();
+
+void queryNotSupportedOnResource(crow::Response& res);
+
+/**
+ * @brief Formats QueryNotSupportedOnOperation message into JSON
+ * Message body: "Querying is not supported with the requested operation."
+ *
+ *
+ * @returns Message QueryNotSupportedOnOperation formatted to JSON */
+nlohmann::json queryNotSupportedOnOperation();
+
+void queryNotSupportedOnOperation(crow::Response& res);
+
+/**
+ * @brief Formats QueryNotSupported message into JSON
+ * Message body: "Querying is not supported by the implementation."
+ *
+ *
+ * @returns Message QueryNotSupported formatted to JSON */
+nlohmann::json queryNotSupported();
+
+void queryNotSupported(crow::Response& res);
+
+/**
+ * @brief Formats QueryCombinationInvalid message into JSON
+ * Message body: "Two or more query parameters in the request cannot be used
+ * together."
+ *
+ *
+ * @returns Message QueryCombinationInvalid formatted to JSON */
+nlohmann::json queryCombinationInvalid();
+
+void queryCombinationInvalid(crow::Response& res);
+
+/**
+ * @brief Formats QueryParameterUnsupported message into JSON
+ * Message body: "Query parameter <arg1> is not supported."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message QueryParameterUnsupported formatted to JSON */
+nlohmann::json queryParameterUnsupported(std::string_view arg1);
+
+void queryParameterUnsupported(crow::Response& res, std::string_view arg1);
+
+/**
+ * @brief Formats SessionLimitExceeded message into JSON
+ * Message body: "The session establishment failed due to the number of
+ * simultaneous sessions exceeding the limit of the implementation."
+ *
+ *
+ * @returns Message SessionLimitExceeded formatted to JSON */
+nlohmann::json sessionLimitExceeded();
+
+void sessionLimitExceeded(crow::Response& res);
+
+/**
+ * @brief Formats EventSubscriptionLimitExceeded message into JSON
+ * Message body: "The event subscription failed due to the number of
+ * simultaneous subscriptions exceeding the limit of the implementation."
+ *
+ *
+ * @returns Message EventSubscriptionLimitExceeded formatted to JSON */
+nlohmann::json eventSubscriptionLimitExceeded();
+
+void eventSubscriptionLimitExceeded(crow::Response& res);
+
+/**
+ * @brief Formats ResourceCannotBeDeleted message into JSON
+ * Message body: "The delete request failed because the resource requested
+ * cannot be deleted."
+ *
+ *
+ * @returns Message ResourceCannotBeDeleted formatted to JSON */
+nlohmann::json resourceCannotBeDeleted();
+
+void resourceCannotBeDeleted(crow::Response& res);
+
+/**
+ * @brief Formats ResourceInUse message into JSON
+ * Message body: "The change to the requested resource failed because the
+ * resource is in use or in transition."
+ *
+ *
+ * @returns Message ResourceInUse formatted to JSON */
+nlohmann::json resourceInUse();
+
+void resourceInUse(crow::Response& res);
+
+/**
+ * @brief Formats ResourceAlreadyExists message into JSON
+ * Message body: "The requested resource of type <arg1> with the property <arg2>
+ * with the value <arg3> already exists."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ * @param[in] arg3 Parameter of message that will replace %3 in its body.
+ *
+ * @returns Message ResourceAlreadyExists formatted to JSON */
+nlohmann::json resourceAlreadyExists(
+    std::string_view arg1, std::string_view arg2, std::string_view arg3);
+
+void resourceAlreadyExists(crow::Response& res, std::string_view arg1,
+                           std::string_view arg2, std::string_view arg3);
+
+/**
+ * @brief Formats ResourceNotFound message into JSON
+ * Message body: "The requested resource of type <arg1> named <arg2> was not
+ * found."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message ResourceNotFound formatted to JSON */
+nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2);
+
+void resourceNotFound(crow::Response& res, std::string_view arg1,
+                      std::string_view arg2);
+
+/**
+ * @brief Formats PayloadTooLarge message into JSON
+ * Message body: "The supplied payload exceeds the maximum size supported by the
+ * service."
+ *
+ *
+ * @returns Message PayloadTooLarge formatted to JSON */
+nlohmann::json payloadTooLarge();
+
+void payloadTooLarge(crow::Response& res);
+
+/**
+ * @brief Formats InsufficientStorage message into JSON
+ * Message body: "Insufficient storage or memory available to complete the
+ * request."
+ *
+ *
+ * @returns Message InsufficientStorage formatted to JSON */
+nlohmann::json insufficientStorage();
+
+void insufficientStorage(crow::Response& res);
+
+/**
+ * @brief Formats MissingOrMalformedPart message into JSON
+ * Message body: "The multipart request contains malformed parts or is missing
+ * required parts."
+ *
+ *
+ * @returns Message MissingOrMalformedPart formatted to JSON */
+nlohmann::json missingOrMalformedPart();
+
+void missingOrMalformedPart(crow::Response& res);
+
+/**
+ * @brief Formats InvalidURI message into JSON
+ * Message body: "The URI <arg1> was not found."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message InvalidURI formatted to JSON */
+nlohmann::json invalidURI(std::string_view arg1);
+
+void invalidURI(crow::Response& res, std::string_view arg1);
+
+/**
+ * @brief Formats CreateFailedMissingReqProperties message into JSON
+ * Message body: "The create operation failed because the required property
+ * <arg1> was missing from the request."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message CreateFailedMissingReqProperties formatted to JSON */
+nlohmann::json createFailedMissingReqProperties(std::string_view arg1);
+
+void createFailedMissingReqProperties(crow::Response& res,
+                                      std::string_view arg1);
+
+/**
+ * @brief Formats CreateLimitReachedForResource message into JSON
+ * Message body: "The create operation failed because the resource has reached
+ * the limit of possible resources."
+ *
+ *
+ * @returns Message CreateLimitReachedForResource formatted to JSON */
+nlohmann::json createLimitReachedForResource();
+
+void createLimitReachedForResource(crow::Response& res);
+
+/**
+ * @brief Formats ServiceShuttingDown message into JSON
+ * Message body: "The operation failed because the service is shutting down and
+ * can no longer take incoming requests."
+ *
+ *
+ * @returns Message ServiceShuttingDown formatted to JSON */
+nlohmann::json serviceShuttingDown();
+
+void serviceShuttingDown(crow::Response& res);
+
+/**
+ * @brief Formats ServiceInUnknownState message into JSON
+ * Message body: "The operation failed because the service is in an unknown
+ * state and can no longer take incoming requests."
+ *
+ *
+ * @returns Message ServiceInUnknownState formatted to JSON */
+nlohmann::json serviceInUnknownState();
+
+void serviceInUnknownState(crow::Response& res);
+
+/**
+ * @brief Formats NoValidSession message into JSON
+ * Message body: "There is no valid session established with the
+ * implementation."
+ *
+ *
+ * @returns Message NoValidSession formatted to JSON */
+nlohmann::json noValidSession();
+
+void noValidSession(crow::Response& res);
+
+/**
+ * @brief Formats InsufficientPrivilege message into JSON
+ * Message body: "There are insufficient privileges for the account or
+ * credentials associated with the current session to perform the requested
+ * operation."
+ *
+ *
+ * @returns Message InsufficientPrivilege formatted to JSON */
+nlohmann::json insufficientPrivilege();
+
+void insufficientPrivilege(crow::Response& res);
+
+/**
+ * @brief Formats AccountModified message into JSON
+ * Message body: "The account was successfully modified."
+ *
+ *
+ * @returns Message AccountModified formatted to JSON */
+nlohmann::json accountModified();
+
+void accountModified(crow::Response& res);
+
+/**
+ * @brief Formats AccountNotModified message into JSON
+ * Message body: "The account modification request failed."
+ *
+ *
+ * @returns Message AccountNotModified formatted to JSON */
+nlohmann::json accountNotModified();
+
+void accountNotModified(crow::Response& res);
+
+/**
+ * @brief Formats AccountRemoved message into JSON
+ * Message body: "The account was successfully removed."
+ *
+ *
+ * @returns Message AccountRemoved formatted to JSON */
+nlohmann::json accountRemoved();
+
+void accountRemoved(crow::Response& res);
+
+/**
+ * @brief Formats AccountForSessionNoLongerExists message into JSON
+ * Message body: "The account for the current session was removed, and so the
+ * current session was removed as well."
+ *
+ *
+ * @returns Message AccountForSessionNoLongerExists formatted to JSON */
+nlohmann::json accountForSessionNoLongerExists();
+
+void accountForSessionNoLongerExists(crow::Response& res);
+
+/**
+ * @brief Formats InvalidObject message into JSON
+ * Message body: "The object at <arg1> is invalid."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message InvalidObject formatted to JSON */
+nlohmann::json invalidObject(const boost::urls::url_view_base& arg1);
+
+void invalidObject(crow::Response& res, const boost::urls::url_view_base& arg1);
+
+/**
+ * @brief Formats InternalError message into JSON
+ * Message body: "The request failed due to an internal service error.  The
+ * service is still operational."
+ *
+ *
+ * @returns Message InternalError formatted to JSON */
+nlohmann::json internalError();
+
+void internalError(crow::Response& res, std::source_location location =
+                                            std::source_location::current());
+
+/**
+ * @brief Formats UnrecognizedRequestBody message into JSON
+ * Message body: "The service detected a malformed request body that it was
+ * unable to interpret."
+ *
+ *
+ * @returns Message UnrecognizedRequestBody formatted to JSON */
+nlohmann::json unrecognizedRequestBody();
+
+void unrecognizedRequestBody(crow::Response& res);
+
+/**
+ * @brief Formats ResourceMissingAtURI message into JSON
+ * Message body: "The resource at the URI <arg1> was not found."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message ResourceMissingAtURI formatted to JSON */
+nlohmann::json resourceMissingAtURI(const boost::urls::url_view_base& arg1);
+
+void resourceMissingAtURI(crow::Response& res,
+                          const boost::urls::url_view_base& arg1);
+
+/**
+ * @brief Formats ResourceAtUriInUnknownFormat message into JSON
+ * Message body: "The resource at <arg1> is in a format not recognized by the
+ * service."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message ResourceAtUriInUnknownFormat formatted to JSON */
+nlohmann::json
+    resourceAtUriInUnknownFormat(const boost::urls::url_view_base& arg1);
+
+void resourceAtUriInUnknownFormat(crow::Response& res,
+                                  const boost::urls::url_view_base& arg1);
+
+/**
+ * @brief Formats ResourceAtUriUnauthorized message into JSON
+ * Message body: "While accessing the resource at <arg1>, the service received
+ * an authorization error <arg2>."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message ResourceAtUriUnauthorized formatted to JSON */
+nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view_base& arg1,
+                                         std::string_view arg2);
+
+void resourceAtUriUnauthorized(crow::Response& res,
+                               const boost::urls::url_view_base& arg1,
+                               std::string_view arg2);
+
+/**
+ * @brief Formats CouldNotEstablishConnection message into JSON
+ * Message body: "The service failed to establish a connection with the URI
+ * <arg1>."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message CouldNotEstablishConnection formatted to JSON */
+nlohmann::json
+    couldNotEstablishConnection(const boost::urls::url_view_base& arg1);
+
+void couldNotEstablishConnection(crow::Response& res,
+                                 const boost::urls::url_view_base& arg1);
+
+/**
+ * @brief Formats SourceDoesNotSupportProtocol message into JSON
+ * Message body: "The other end of the connection at <arg1> does not support the
+ * specified protocol <arg2>."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message SourceDoesNotSupportProtocol formatted to JSON */
+nlohmann::json sourceDoesNotSupportProtocol(
+    const boost::urls::url_view_base& arg1, std::string_view arg2);
+
+void sourceDoesNotSupportProtocol(crow::Response& res,
+                                  const boost::urls::url_view_base& arg1,
+                                  std::string_view arg2);
+
+/**
+ * @brief Formats AccessDenied message into JSON
+ * Message body: "While attempting to establish a connection to <arg1>, the
+ * service denied access."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message AccessDenied formatted to JSON */
+nlohmann::json accessDenied(const boost::urls::url_view_base& arg1);
+
+void accessDenied(crow::Response& res, const boost::urls::url_view_base& arg1);
+
+/**
+ * @brief Formats ServiceTemporarilyUnavailable message into JSON
+ * Message body: "The service is temporarily unavailable.  Retry in <arg1>
+ * seconds."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message ServiceTemporarilyUnavailable formatted to JSON */
+nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1);
+
+void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1);
+
+/**
+ * @brief Formats InvalidIndex message into JSON
+ * Message body: "The index <arg1> is not a valid offset into the array."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message InvalidIndex formatted to JSON */
+nlohmann::json invalidIndex(int64_t arg1);
+
+void invalidIndex(crow::Response& res, int64_t arg1);
+
+/**
+ * @brief Formats PropertyValueModified message into JSON
+ * Message body: "The property <arg1> was assigned the value <arg2> due to
+ * modification by the service."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message PropertyValueModified formatted to JSON */
+nlohmann::json propertyValueModified(std::string_view arg1,
+                                     const nlohmann::json& arg2);
+
+void propertyValueModified(crow::Response& res, std::string_view arg1,
+                           const nlohmann::json& arg2);
+
+/**
+ * @brief Formats ResourceInStandby message into JSON
+ * Message body: "The request could not be performed because the resource is in
+ * standby."
+ *
+ *
+ * @returns Message ResourceInStandby formatted to JSON */
+nlohmann::json resourceInStandby();
+
+void resourceInStandby(crow::Response& res);
+
+/**
+ * @brief Formats ResourceExhaustion message into JSON
+ * Message body: "The resource <arg1> was unable to satisfy the request due to
+ * unavailability of resources."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message ResourceExhaustion formatted to JSON */
+nlohmann::json resourceExhaustion(std::string_view arg1);
+
+void resourceExhaustion(crow::Response& res, std::string_view arg1);
+
+/**
  * @brief Formats StringValueTooLong message into JSON
  * Message body: "The string <arg1> exceeds the length limit <arg2>."
  *
@@ -354,6 +954,21 @@
 void stringValueTooLong(crow::Response& res, std::string_view arg1, int arg2);
 
 /**
+ * @brief Formats StringValueTooShort message into JSON
+ * Message body: "The string <arg1> was under the minimum required length
+ * <arg2>."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message StringValueTooShort formatted to JSON */
+nlohmann::json stringValueTooShort(std::string_view arg1,
+                                   std::string_view arg2);
+
+void stringValueTooShort(crow::Response& res, std::string_view arg1,
+                         std::string_view arg2);
+
+/**
  * @brief Formats SessionTerminated message into JSON
  * Message body: "The session was successfully terminated."
  *
@@ -389,6 +1004,20 @@
                               std::string_view arg2);
 
 /**
+ * @brief Formats PasswordChangeRequired message into JSON
+ * Message body: "The password provided for this account must be changed before
+ * access is granted.  PATCH the Password property for this account located at
+ * the target URI <arg1> to complete this process."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message PasswordChangeRequired formatted to JSON */
+nlohmann::json passwordChangeRequired(const boost::urls::url_view_base& arg1);
+
+void passwordChangeRequired(crow::Response& res,
+                            const boost::urls::url_view_base& arg1);
+
+/**
  * @brief Formats ResetRequired message into JSON
  * Message body: "In order to apply changes, recover from errors, or complete
  * the operation, a component reset is required with the Reset action URI <arg1>
@@ -405,6 +1034,20 @@
                    std::string_view arg2);
 
 /**
+ * @brief Formats ResetRecommended message into JSON
+ * Message body: "In order to recover from errors, a component reset is
+ * recommended with the Reset action URI <arg1> and ResetType <arg2>."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message ResetRecommended formatted to JSON */
+nlohmann::json resetRecommended(std::string_view arg1, std::string_view arg2);
+
+void resetRecommended(crow::Response& res, std::string_view arg1,
+                      std::string_view arg2);
+
+/**
  * @brief Formats ChassisPowerStateOnRequired message into JSON
  * Message body: "The chassis with Id <arg1> is required to be powered on to
  * perform this request."
@@ -508,6 +1151,21 @@
                               const boost::urls::url_view_base& arg1);
 
 /**
+ * @brief Formats ActionParameterValueConflict message into JSON
+ * Message body: "The parameter <arg1> with the requested value of <arg2> does
+ * not meet the constraints of the implementation."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message ActionParameterValueConflict formatted to JSON */
+nlohmann::json
+    actionParameterValueConflict(std::string_view arg1, std::string_view arg2);
+
+void actionParameterValueConflict(crow::Response& res, std::string_view arg1,
+                                  std::string_view arg2);
+
+/**
  * @brief Formats MaximumErrorsExceeded message into JSON
  * Message body: "Too many errors have occurred to report them all."
  *
@@ -540,6 +1198,28 @@
 void preconditionRequired(crow::Response& res);
 
 /**
+ * @brief Formats HeaderMissing message into JSON
+ * Message body: "Required header <arg1> is missing in the request."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message HeaderMissing formatted to JSON */
+nlohmann::json headerMissing(std::string_view arg1);
+
+void headerMissing(crow::Response& res, std::string_view arg1);
+
+/**
+ * @brief Formats HeaderInvalid message into JSON
+ * Message body: "Header <arg1> is invalid."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message HeaderInvalid formatted to JSON */
+nlohmann::json headerInvalid(std::string_view arg1);
+
+void headerInvalid(crow::Response& res, std::string_view arg1);
+
+/**
  * @brief Formats OperationFailed message into JSON
  * Message body: "An error occurred internal to the service as part of the
  * overall request.  Partial results may have been returned."
@@ -562,533 +1242,6 @@
 void operationTimeout(crow::Response& res);
 
 /**
- * @brief Formats PropertyValueTypeError message into JSON
- * Message body: "The value <arg1> for the property <arg2> is not a type that
- * the property can accept."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message PropertyValueTypeError formatted to JSON */
-nlohmann::json propertyValueTypeError(const nlohmann::json& arg1,
-                                      std::string_view arg2);
-
-void propertyValueTypeError(crow::Response& res, const nlohmann::json& arg1,
-                            std::string_view arg2);
-
-/**
- * @brief Formats PropertyValueError message into JSON
- * Message body: "The value provided for the property <arg1> is not valid."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message PropertyValueError formatted to JSON */
-nlohmann::json propertyValueError(std::string_view arg1);
-
-void propertyValueError(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats ResourceNotFound message into JSON
- * Message body: "The requested resource of type <arg1> named <arg2> was not
- * found."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message ResourceNotFound formatted to JSON */
-nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2);
-
-void resourceNotFound(crow::Response& res, std::string_view arg1,
-                      std::string_view arg2);
-
-/**
- * @brief Formats CouldNotEstablishConnection message into JSON
- * Message body: "The service failed to establish a connection with the URI
- * <arg1>."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message CouldNotEstablishConnection formatted to JSON */
-nlohmann::json
-    couldNotEstablishConnection(const boost::urls::url_view_base& arg1);
-
-void couldNotEstablishConnection(crow::Response& res,
-                                 const boost::urls::url_view_base& arg1);
-
-/**
- * @brief Formats PropertyNotWritable message into JSON
- * Message body: "The property <arg1> is a read-only property and cannot be
- * assigned a value."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message PropertyNotWritable formatted to JSON */
-nlohmann::json propertyNotWritable(std::string_view arg1);
-
-void propertyNotWritable(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats QueryParameterValueTypeError message into JSON
- * Message body: "The value <arg1> for the query parameter <arg2> is not a type
- * that the parameter can accept."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message QueryParameterValueTypeError formatted to JSON */
-nlohmann::json queryParameterValueTypeError(const nlohmann::json& arg1,
-                                            std::string_view arg2);
-
-void queryParameterValueTypeError(
-    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2);
-
-/**
- * @brief Formats ServiceShuttingDown message into JSON
- * Message body: "The operation failed because the service is shutting down and
- * can no longer take incoming requests."
- *
- *
- * @returns Message ServiceShuttingDown formatted to JSON */
-nlohmann::json serviceShuttingDown();
-
-void serviceShuttingDown(crow::Response& res);
-
-/**
- * @brief Formats ActionParameterDuplicate message into JSON
- * Message body: "The action <arg1> was submitted with more than one value for
- * the parameter <arg2>."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message ActionParameterDuplicate formatted to JSON */
-nlohmann::json actionParameterDuplicate(std::string_view arg1,
-                                        std::string_view arg2);
-
-void actionParameterDuplicate(crow::Response& res, std::string_view arg1,
-                              std::string_view arg2);
-
-/**
- * @brief Formats ActionParameterNotSupported message into JSON
- * Message body: "The parameter <arg1> for the action <arg2> is not supported on
- * the target resource."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message ActionParameterNotSupported formatted to JSON */
-nlohmann::json actionParameterNotSupported(std::string_view arg1,
-                                           std::string_view arg2);
-
-void actionParameterNotSupported(crow::Response& res, std::string_view arg1,
-                                 std::string_view arg2);
-
-/**
- * @brief Formats SourceDoesNotSupportProtocol message into JSON
- * Message body: "The other end of the connection at <arg1> does not support the
- * specified protocol <arg2>."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message SourceDoesNotSupportProtocol formatted to JSON */
-nlohmann::json sourceDoesNotSupportProtocol(
-    const boost::urls::url_view_base& arg1, std::string_view arg2);
-
-void sourceDoesNotSupportProtocol(crow::Response& res,
-                                  const boost::urls::url_view_base& arg1,
-                                  std::string_view arg2);
-
-/**
- * @brief Formats StrictAccountTypes message into JSON
- * Message body: "The request could not be fulfilled with the account types
- * included in property <arg1> because the property StrictAccountTypes is set to
- * true."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message StrictAccountTypes formatted to JSON */
-nlohmann::json strictAccountTypes(std::string_view arg1);
-
-void strictAccountTypes(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats AccountRemoved message into JSON
- * Message body: "The account was successfully removed."
- *
- *
- * @returns Message AccountRemoved formatted to JSON */
-nlohmann::json accountRemoved();
-
-void accountRemoved(crow::Response& res);
-
-/**
- * @brief Formats AccessDenied message into JSON
- * Message body: "While attempting to establish a connection to <arg1>, the
- * service denied access."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message AccessDenied formatted to JSON */
-nlohmann::json accessDenied(const boost::urls::url_view_base& arg1);
-
-void accessDenied(crow::Response& res, const boost::urls::url_view_base& arg1);
-
-/**
- * @brief Formats QueryNotSupported message into JSON
- * Message body: "Querying is not supported by the implementation."
- *
- *
- * @returns Message QueryNotSupported formatted to JSON */
-nlohmann::json queryNotSupported();
-
-void queryNotSupported(crow::Response& res);
-
-/**
- * @brief Formats CreateLimitReachedForResource message into JSON
- * Message body: "The create operation failed because the resource has reached
- * the limit of possible resources."
- *
- *
- * @returns Message CreateLimitReachedForResource formatted to JSON */
-nlohmann::json createLimitReachedForResource();
-
-void createLimitReachedForResource(crow::Response& res);
-
-/**
- * @brief Formats GeneralError message into JSON
- * Message body: "A general error has occurred.  See Resolution for information
- * on how to resolve the error, or @Message.ExtendedInfo if Resolution is not
- * provided."
- *
- *
- * @returns Message GeneralError formatted to JSON */
-nlohmann::json generalError();
-
-void generalError(crow::Response& res);
-
-/**
- * @brief Formats Success message into JSON
- * Message body: "The request completed successfully."
- *
- *
- * @returns Message Success formatted to JSON */
-nlohmann::json success();
-
-void success(crow::Response& res);
-
-/**
- * @brief Formats Created message into JSON
- * Message body: "The resource was created successfully."
- *
- *
- * @returns Message Created formatted to JSON */
-nlohmann::json created();
-
-void created(crow::Response& res);
-
-/**
- * @brief Formats NoOperation message into JSON
- * Message body: "The request body submitted contain no data to act upon and no
- * changes to the resource took place."
- *
- *
- * @returns Message NoOperation formatted to JSON */
-nlohmann::json noOperation();
-
-void noOperation(crow::Response& res);
-
-/**
- * @brief Formats PropertyUnknown message into JSON
- * Message body: "The property <arg1> is not in the list of valid properties for
- * the resource."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message PropertyUnknown formatted to JSON */
-nlohmann::json propertyUnknown(std::string_view arg1);
-
-void propertyUnknown(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats NoValidSession message into JSON
- * Message body: "There is no valid session established with the
- * implementation."
- *
- *
- * @returns Message NoValidSession formatted to JSON */
-nlohmann::json noValidSession();
-
-void noValidSession(crow::Response& res);
-
-/**
- * @brief Formats InvalidObject message into JSON
- * Message body: "The object at <arg1> is invalid."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message InvalidObject formatted to JSON */
-nlohmann::json invalidObject(const boost::urls::url_view_base& arg1);
-
-void invalidObject(crow::Response& res, const boost::urls::url_view_base& arg1);
-
-/**
- * @brief Formats ResourceInStandby message into JSON
- * Message body: "The request could not be performed because the resource is in
- * standby."
- *
- *
- * @returns Message ResourceInStandby formatted to JSON */
-nlohmann::json resourceInStandby();
-
-void resourceInStandby(crow::Response& res);
-
-/**
- * @brief Formats ActionParameterValueTypeError message into JSON
- * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3>
- * is not a type that the parameter can accept."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- * @param[in] arg3 Parameter of message that will replace %3 in its body.
- *
- * @returns Message ActionParameterValueTypeError formatted to JSON */
-nlohmann::json actionParameterValueTypeError(
-    const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3);
-
-void actionParameterValueTypeError(
-    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2,
-    std::string_view arg3);
-
-/**
- * @brief Formats ActionParameterValueError message into JSON
- * Message body: "The value for the parameter <arg1> in the action <arg2> is
- * invalid."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message ActionParameterValueError formatted to JSON */
-nlohmann::json actionParameterValueError(const nlohmann::json& arg1,
-                                         std::string_view arg2);
-
-void actionParameterValueError(crow::Response& res, const nlohmann::json& arg1,
-                               std::string_view arg2);
-
-/**
- * @brief Formats SessionLimitExceeded message into JSON
- * Message body: "The session establishment failed due to the number of
- * simultaneous sessions exceeding the limit of the implementation."
- *
- *
- * @returns Message SessionLimitExceeded formatted to JSON */
-nlohmann::json sessionLimitExceeded();
-
-void sessionLimitExceeded(crow::Response& res);
-
-/**
- * @brief Formats ActionNotSupported message into JSON
- * Message body: "The action <arg1> is not supported by the resource."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message ActionNotSupported formatted to JSON */
-nlohmann::json actionNotSupported(std::string_view arg1);
-
-void actionNotSupported(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats InvalidIndex message into JSON
- * Message body: "The index <arg1> is not a valid offset into the array."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message InvalidIndex formatted to JSON */
-nlohmann::json invalidIndex(int64_t arg1);
-
-void invalidIndex(crow::Response& res, int64_t arg1);
-
-/**
- * @brief Formats EmptyJSON message into JSON
- * Message body: "The request body submitted contained an empty JSON object and
- * the service is unable to process it."
- *
- *
- * @returns Message EmptyJSON formatted to JSON */
-nlohmann::json emptyJSON();
-
-void emptyJSON(crow::Response& res);
-
-/**
- * @brief Formats QueryNotSupportedOnResource message into JSON
- * Message body: "Querying is not supported on the requested resource."
- *
- *
- * @returns Message QueryNotSupportedOnResource formatted to JSON */
-nlohmann::json queryNotSupportedOnResource();
-
-void queryNotSupportedOnResource(crow::Response& res);
-
-/**
- * @brief Formats QueryNotSupportedOnOperation message into JSON
- * Message body: "Querying is not supported with the requested operation."
- *
- *
- * @returns Message QueryNotSupportedOnOperation formatted to JSON */
-nlohmann::json queryNotSupportedOnOperation();
-
-void queryNotSupportedOnOperation(crow::Response& res);
-
-/**
- * @brief Formats QueryCombinationInvalid message into JSON
- * Message body: "Two or more query parameters in the request cannot be used
- * together."
- *
- *
- * @returns Message QueryCombinationInvalid formatted to JSON */
-nlohmann::json queryCombinationInvalid();
-
-void queryCombinationInvalid(crow::Response& res);
-
-/**
- * @brief Formats EventBufferExceeded message into JSON
- * Message body: "Undelivered events may have been lost due to exceeding the
- * event buffer."
- *
- *
- * @returns Message EventBufferExceeded formatted to JSON */
-nlohmann::json eventBufferExceeded();
-
-void eventBufferExceeded(crow::Response& res);
-
-/**
- * @brief Formats InsufficientPrivilege message into JSON
- * Message body: "There are insufficient privileges for the account or
- * credentials associated with the current session to perform the requested
- * operation."
- *
- *
- * @returns Message InsufficientPrivilege formatted to JSON */
-nlohmann::json insufficientPrivilege();
-
-void insufficientPrivilege(crow::Response& res);
-
-/**
- * @brief Formats PropertyValueModified message into JSON
- * Message body: "The property <arg1> was assigned the value <arg2> due to
- * modification by the service."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message PropertyValueModified formatted to JSON */
-nlohmann::json propertyValueModified(std::string_view arg1,
-                                     const nlohmann::json& arg2);
-
-void propertyValueModified(crow::Response& res, std::string_view arg1,
-                           const nlohmann::json& arg2);
-
-/**
- * @brief Formats AccountNotModified message into JSON
- * Message body: "The account modification request failed."
- *
- *
- * @returns Message AccountNotModified formatted to JSON */
-nlohmann::json accountNotModified();
-
-void accountNotModified(crow::Response& res);
-
-/**
- * @brief Formats QueryParameterValueFormatError message into JSON
- * Message body: "The value <arg1> for the parameter <arg2> is not a format that
- * the parameter can accept."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message QueryParameterValueFormatError formatted to JSON */
-nlohmann::json queryParameterValueFormatError(const nlohmann::json& arg1,
-                                              std::string_view arg2);
-
-void queryParameterValueFormatError(
-    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2);
-
-/**
- * @brief Formats PropertyMissing message into JSON
- * Message body: "The property <arg1> is a required property and must be
- * included in the request."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message PropertyMissing formatted to JSON */
-nlohmann::json propertyMissing(std::string_view arg1);
-
-void propertyMissing(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats ResourceExhaustion message into JSON
- * Message body: "The resource <arg1> was unable to satisfy the request due to
- * unavailability of resources."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message ResourceExhaustion formatted to JSON */
-nlohmann::json resourceExhaustion(std::string_view arg1);
-
-void resourceExhaustion(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats AccountModified message into JSON
- * Message body: "The account was successfully modified."
- *
- *
- * @returns Message AccountModified formatted to JSON */
-nlohmann::json accountModified();
-
-void accountModified(crow::Response& res);
-
-/**
- * @brief Formats QueryParameterOutOfRange message into JSON
- * Message body: "The value <arg1> for the query parameter <arg2> is out of
- * range <arg3>."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- * @param[in] arg3 Parameter of message that will replace %3 in its body.
- *
- * @returns Message QueryParameterOutOfRange formatted to JSON */
-nlohmann::json queryParameterOutOfRange(
-    std::string_view arg1, std::string_view arg2, std::string_view arg3);
-
-void queryParameterOutOfRange(crow::Response& res, std::string_view arg1,
-                              std::string_view arg2, std::string_view arg3);
-
-/**
- * @brief Formats PasswordChangeRequired message into JSON
- * Message body: "The password provided for this account must be changed before
- * access is granted.  PATCH the Password property for this account located at
- * the target URI <arg1> to complete this process."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message PasswordChangeRequired formatted to JSON */
-nlohmann::json passwordChangeRequired(const boost::urls::url_view_base& arg1);
-
-void passwordChangeRequired(crow::Response& res,
-                            const boost::urls::url_view_base& arg1);
-
-/**
- * @brief Formats InsufficientStorage message into JSON
- * Message body: "Insufficient storage or memory available to complete the
- * request."
- *
- *
- * @returns Message InsufficientStorage formatted to JSON */
-nlohmann::json insufficientStorage();
-
-void insufficientStorage(crow::Response& res);
-
-/**
  * @brief Formats OperationNotAllowed message into JSON
  * Message body: "The HTTP method is not allowed on this resource."
  *
@@ -1099,212 +1252,6 @@
 void operationNotAllowed(crow::Response& res);
 
 /**
- * @brief Formats ArraySizeTooLong message into JSON
- * Message body: "The array provided for property <arg1> exceeds the size limit
- * <arg2>."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message ArraySizeTooLong formatted to JSON */
-nlohmann::json arraySizeTooLong(std::string_view arg1, uint64_t arg2);
-
-void arraySizeTooLong(crow::Response& res, std::string_view arg1,
-                      uint64_t arg2);
-
-/**
- * @brief Formats GenerateSecretKeyRequired message into JSON
- * Message body: "The Time-based One-Time Password (TOTP) secret key for this
- * account must be generated before access is granted.  Perform the
- * GenerateSecretKey action at URI <arg1> and retain the secret key from the
- * response."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message GenerateSecretKeyRequired formatted to JSON */
-nlohmann::json
-    generateSecretKeyRequired(const boost::urls::url_view_base& arg1);
-
-void generateSecretKeyRequired(crow::Response& res,
-                               const boost::urls::url_view_base& arg1);
-
-/**
- * @brief Formats PropertyNotUpdated message into JSON
- * Message body: "The property <arg1> was not updated due to an internal service
- * error.  The service is still operational."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message PropertyNotUpdated formatted to JSON */
-nlohmann::json propertyNotUpdated(std::string_view arg1);
-
-void propertyNotUpdated(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats InvalidJSON message into JSON
- * Message body: "The request body submitted is invalid JSON starting at line
- * <arg1> and could not be parsed by the receiving service."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message InvalidJSON formatted to JSON */
-nlohmann::json invalidJSON(std::string_view arg1);
-
-void invalidJSON(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats ActionParameterValueOutOfRange message into JSON
- * Message body: "The value <arg1> for the parameter <arg2> in the action <arg3>
- * is not in the supported range of acceptable values."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- * @param[in] arg3 Parameter of message that will replace %3 in its body.
- *
- * @returns Message ActionParameterValueOutOfRange formatted to JSON */
-nlohmann::json actionParameterValueOutOfRange(
-    std::string_view arg1, std::string_view arg2, std::string_view arg3);
-
-void actionParameterValueOutOfRange(crow::Response& res, std::string_view arg1,
-                                    std::string_view arg2,
-                                    std::string_view arg3);
-
-/**
- * @brief Formats ArraySizeTooShort message into JSON
- * Message body: "The array provided for property <arg1> is under the minimum
- * size limit <arg2>."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message ArraySizeTooShort formatted to JSON */
-nlohmann::json arraySizeTooShort(std::string_view arg1, std::string_view arg2);
-
-void arraySizeTooShort(crow::Response& res, std::string_view arg1,
-                       std::string_view arg2);
-
-/**
- * @brief Formats QueryParameterValueError message into JSON
- * Message body: "The value for the parameter <arg1> is invalid."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message QueryParameterValueError formatted to JSON */
-nlohmann::json queryParameterValueError(std::string_view arg1);
-
-void queryParameterValueError(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats QueryParameterUnsupported message into JSON
- * Message body: "Query parameter <arg1> is not supported."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message QueryParameterUnsupported formatted to JSON */
-nlohmann::json queryParameterUnsupported(std::string_view arg1);
-
-void queryParameterUnsupported(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats PayloadTooLarge message into JSON
- * Message body: "The supplied payload exceeds the maximum size supported by the
- * service."
- *
- *
- * @returns Message PayloadTooLarge formatted to JSON */
-nlohmann::json payloadTooLarge();
-
-void payloadTooLarge(crow::Response& res);
-
-/**
- * @brief Formats MissingOrMalformedPart message into JSON
- * Message body: "The multipart request contains malformed parts or is missing
- * required parts."
- *
- *
- * @returns Message MissingOrMalformedPart formatted to JSON */
-nlohmann::json missingOrMalformedPart();
-
-void missingOrMalformedPart(crow::Response& res);
-
-/**
- * @brief Formats InvalidURI message into JSON
- * Message body: "The URI <arg1> was not found."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message InvalidURI formatted to JSON */
-nlohmann::json invalidURI(std::string_view arg1);
-
-void invalidURI(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats StringValueTooShort message into JSON
- * Message body: "The string <arg1> was under the minimum required length
- * <arg2>."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message StringValueTooShort formatted to JSON */
-nlohmann::json stringValueTooShort(std::string_view arg1,
-                                   std::string_view arg2);
-
-void stringValueTooShort(crow::Response& res, std::string_view arg1,
-                         std::string_view arg2);
-
-/**
- * @brief Formats ResetRecommended message into JSON
- * Message body: "In order to recover from errors, a component reset is
- * recommended with the Reset action URI <arg1> and ResetType <arg2>."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message ResetRecommended formatted to JSON */
-nlohmann::json resetRecommended(std::string_view arg1, std::string_view arg2);
-
-void resetRecommended(crow::Response& res, std::string_view arg1,
-                      std::string_view arg2);
-
-/**
- * @brief Formats ActionParameterValueConflict message into JSON
- * Message body: "The parameter <arg1> with the requested value of <arg2> does
- * not meet the constraints of the implementation."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- * @param[in] arg2 Parameter of message that will replace %2 in its body.
- *
- * @returns Message ActionParameterValueConflict formatted to JSON */
-nlohmann::json
-    actionParameterValueConflict(std::string_view arg1, std::string_view arg2);
-
-void actionParameterValueConflict(crow::Response& res, std::string_view arg1,
-                                  std::string_view arg2);
-
-/**
- * @brief Formats HeaderMissing message into JSON
- * Message body: "Required header <arg1> is missing in the request."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message HeaderMissing formatted to JSON */
-nlohmann::json headerMissing(std::string_view arg1);
-
-void headerMissing(crow::Response& res, std::string_view arg1);
-
-/**
- * @brief Formats HeaderInvalid message into JSON
- * Message body: "Header <arg1> is invalid."
- *
- * @param[in] arg1 Parameter of message that will replace %1 in its body.
- *
- * @returns Message HeaderInvalid formatted to JSON */
-nlohmann::json headerInvalid(std::string_view arg1);
-
-void headerInvalid(crow::Response& res, std::string_view arg1);
-
-/**
  * @brief Formats UndeterminedFault message into JSON
  * Message body: "An undetermined fault condition was reported by <arg1>."
  *
@@ -1351,6 +1298,19 @@
 void restrictedPrivilege(crow::Response& res, std::string_view arg1);
 
 /**
+ * @brief Formats StrictAccountTypes message into JSON
+ * Message body: "The request could not be fulfilled with the account types
+ * included in property <arg1> because the property StrictAccountTypes is set to
+ * true."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message StrictAccountTypes formatted to JSON */
+nlohmann::json strictAccountTypes(std::string_view arg1);
+
+void strictAccountTypes(crow::Response& res, std::string_view arg1);
+
+/**
  * @brief Formats PropertyDeprecated message into JSON
  * Message body: "The deprecated property <arg1> was included in the request
  * body."
@@ -1420,6 +1380,29 @@
 void networkNameResolutionNotSupported(crow::Response& res);
 
 /**
+ * @brief Formats ServiceDisabled message into JSON
+ * Message body: "The operation failed because the service at <arg1> is disabled
+ * and cannot accept requests."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message ServiceDisabled formatted to JSON */
+nlohmann::json serviceDisabled(std::string_view arg1);
+
+void serviceDisabled(crow::Response& res, std::string_view arg1);
+
+/**
+ * @brief Formats EventBufferExceeded message into JSON
+ * Message body: "Undelivered events may have been lost due to exceeding the
+ * event buffer."
+ *
+ *
+ * @returns Message EventBufferExceeded formatted to JSON */
+nlohmann::json eventBufferExceeded();
+
+void eventBufferExceeded(crow::Response& res);
+
+/**
  * @brief Formats AuthenticationTokenRequired message into JSON
  * Message body: "The request could not be performed because an authentication
  * token was not provided."
@@ -1463,5 +1446,21 @@
 
 void propertyModified(crow::Response& res);
 
+/**
+ * @brief Formats GenerateSecretKeyRequired message into JSON
+ * Message body: "The Time-based One-Time Password (TOTP) secret key for this
+ * account must be generated before access is granted.  Perform the
+ * GenerateSecretKey action at URI <arg1> and retain the secret key from the
+ * response."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message GenerateSecretKeyRequired formatted to JSON */
+nlohmann::json
+    generateSecretKeyRequired(const boost::urls::url_view_base& arg1);
+
+void generateSecretKeyRequired(crow::Response& res,
+                               const boost::urls::url_view_base& arg1);
+
 } // namespace messages
 } // namespace redfish
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
index dffa2ca..328cae7 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -162,209 +162,73 @@
 
 /**
  * @internal
- * @brief Formats ResourceInUse message into JSON
+ * @brief Formats Success message into JSON
  *
  * See header file for more information
  * @endinternal
  */
-nlohmann::json resourceInUse()
+nlohmann::json success()
 {
-    return getLog(redfish::registries::base::Index::resourceInUse, {});
+    return getLog(redfish::registries::base::Index::success, {});
 }
 
-void resourceInUse(crow::Response& res)
+void success(crow::Response& res)
 {
-    res.result(boost::beast::http::status::service_unavailable);
-    addMessageToErrorJson(res.jsonValue, resourceInUse());
+    addMessageToJsonRoot(res.jsonValue, success());
 }
 
 /**
  * @internal
- * @brief Formats MalformedJSON message into JSON
+ * @brief Formats GeneralError message into JSON
  *
  * See header file for more information
  * @endinternal
  */
-nlohmann::json malformedJSON()
+nlohmann::json generalError()
 {
-    return getLog(redfish::registries::base::Index::malformedJSON, {});
+    return getLog(redfish::registries::base::Index::generalError, {});
 }
 
-void malformedJSON(crow::Response& res)
+void generalError(crow::Response& res)
 {
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, malformedJSON());
-}
-
-/**
- * @internal
- * @brief Formats ResourceMissingAtURI message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json resourceMissingAtURI(const boost::urls::url_view_base& arg1)
-{
-    return getLog(redfish::registries::base::Index::resourceMissingAtURI,
-                  std::to_array<std::string_view>({arg1.buffer()}));
-}
-
-void resourceMissingAtURI(crow::Response& res,
-                          const boost::urls::url_view_base& arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1));
-}
-
-/**
- * @internal
- * @brief Formats ActionParameterValueFormatError message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json actionParameterValueFormatError(
-    const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3)
-{
-    std::string arg1Str =
-        arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
-    return getLog(
-        redfish::registries::base::Index::actionParameterValueFormatError,
-        std::to_array<std::string_view>({arg1Str, arg2, arg3}));
-}
-
-void actionParameterValueFormatError(
-    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2,
-    std::string_view arg3)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue,
-                          actionParameterValueFormatError(arg1, arg2, arg3));
-}
-
-/**
- * @internal
- * @brief Formats ActionParameterValueNotInList message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json actionParameterValueNotInList(
-    std::string_view arg1, std::string_view arg2, std::string_view arg3)
-{
-    return getLog(
-        redfish::registries::base::Index::actionParameterValueNotInList,
-        std::to_array({arg1, arg2, arg3}));
-}
-
-void actionParameterValueNotInList(crow::Response& res, std::string_view arg1,
-                                   std::string_view arg2, std::string_view arg3)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue,
-                          actionParameterValueNotInList(arg1, arg2, arg3));
-}
-
-/**
- * @internal
- * @brief Formats InternalError message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json internalError()
-{
-    return getLog(redfish::registries::base::Index::internalError, {});
-}
-
-void internalError(crow::Response& res, const std::source_location location)
-{
-    BMCWEB_LOG_CRITICAL("Internal Error {}({}:{}) `{}`: ", location.file_name(),
-                        location.line(), location.column(),
-                        location.function_name());
     res.result(boost::beast::http::status::internal_server_error);
-    addMessageToErrorJson(res.jsonValue, internalError());
+    addMessageToErrorJson(res.jsonValue, generalError());
 }
 
 /**
  * @internal
- * @brief Formats UnrecognizedRequestBody message into JSON
+ * @brief Formats Created message into JSON
  *
  * See header file for more information
  * @endinternal
  */
-nlohmann::json unrecognizedRequestBody()
+nlohmann::json created()
 {
-    return getLog(redfish::registries::base::Index::unrecognizedRequestBody,
-                  {});
+    return getLog(redfish::registries::base::Index::created, {});
 }
 
-void unrecognizedRequestBody(crow::Response& res)
+void created(crow::Response& res)
+{
+    res.result(boost::beast::http::status::created);
+    addMessageToJsonRoot(res.jsonValue, created());
+}
+
+/**
+ * @internal
+ * @brief Formats NoOperation message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json noOperation()
+{
+    return getLog(redfish::registries::base::Index::noOperation, {});
+}
+
+void noOperation(crow::Response& res)
 {
     res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody());
-}
-
-/**
- * @internal
- * @brief Formats ResourceAtUriUnauthorized message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view_base& arg1,
-                                         std::string_view arg2)
-{
-    return getLog(redfish::registries::base::Index::resourceAtUriUnauthorized,
-                  std::to_array<std::string_view>({arg1.buffer(), arg2}));
-}
-
-void resourceAtUriUnauthorized(crow::Response& res,
-                               const boost::urls::url_view_base& arg1,
-                               std::string_view arg2)
-{
-    res.result(boost::beast::http::status::unauthorized);
-    addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats ActionParameterUnknown message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json actionParameterUnknown(std::string_view arg1,
-                                      std::string_view arg2)
-{
-    return getLog(redfish::registries::base::Index::actionParameterUnknown,
-                  std::to_array({arg1, arg2}));
-}
-
-void actionParameterUnknown(crow::Response& res, std::string_view arg1,
-                            std::string_view arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats ResourceCannotBeDeleted message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json resourceCannotBeDeleted()
-{
-    return getLog(redfish::registries::base::Index::resourceCannotBeDeleted,
-                  {});
-}
-
-void resourceCannotBeDeleted(crow::Response& res)
-{
-    res.result(boost::beast::http::status::method_not_allowed);
-    addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted());
+    addMessageToErrorJson(res.jsonValue, noOperation());
 }
 
 /**
@@ -388,86 +252,44 @@
 
 /**
  * @internal
- * @brief Formats ServiceTemporarilyUnavailable message into JSON
+ * @brief Formats PropertyUnknown message into JSON
  *
  * See header file for more information
  * @endinternal
  */
-nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1)
+nlohmann::json propertyUnknown(std::string_view arg1)
 {
-    return getLog(
-        redfish::registries::base::Index::serviceTemporarilyUnavailable,
-        std::to_array({arg1}));
+    return getLog(redfish::registries::base::Index::propertyUnknown,
+                  std::to_array({arg1}));
 }
 
-void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1)
-{
-    res.addHeader(boost::beast::http::field::retry_after, arg1);
-    res.result(boost::beast::http::status::service_unavailable);
-    addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1));
-}
-
-/**
- * @internal
- * @brief Formats ResourceAlreadyExists message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json resourceAlreadyExists(
-    std::string_view arg1, std::string_view arg2, std::string_view arg3)
-{
-    return getLog(redfish::registries::base::Index::resourceAlreadyExists,
-                  std::to_array({arg1, arg2, arg3}));
-}
-
-void resourceAlreadyExists(crow::Response& res, std::string_view arg1,
-                           std::string_view arg2, std::string_view arg3)
+void propertyUnknown(crow::Response& res, std::string_view arg1)
 {
     res.result(boost::beast::http::status::bad_request);
-    addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3),
-                     arg2);
+    addMessageToErrorJson(res.jsonValue, propertyUnknown(arg1));
 }
 
 /**
  * @internal
- * @brief Formats AccountForSessionNoLongerExists message into JSON
+ * @brief Formats PropertyValueTypeError message into JSON
  *
  * See header file for more information
  * @endinternal
  */
-nlohmann::json accountForSessionNoLongerExists()
+nlohmann::json propertyValueTypeError(const nlohmann::json& arg1,
+                                      std::string_view arg2)
 {
-    return getLog(
-        redfish::registries::base::Index::accountForSessionNoLongerExists, {});
+    std::string arg1Str =
+        arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
+    return getLog(redfish::registries::base::Index::propertyValueTypeError,
+                  std::to_array<std::string_view>({arg1Str, arg2}));
 }
 
-void accountForSessionNoLongerExists(crow::Response& res)
-{
-    res.result(boost::beast::http::status::forbidden);
-    addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists());
-}
-
-/**
- * @internal
- * @brief Formats CreateFailedMissingReqProperties message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json createFailedMissingReqProperties(std::string_view arg1)
-{
-    return getLog(
-        redfish::registries::base::Index::createFailedMissingReqProperties,
-        std::to_array({arg1}));
-}
-
-void createFailedMissingReqProperties(crow::Response& res,
-                                      std::string_view arg1)
+void propertyValueTypeError(crow::Response& res, const nlohmann::json& arg1,
+                            std::string_view arg2)
 {
     res.result(boost::beast::http::status::bad_request);
-    addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1),
-                     arg1);
+    addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2);
 }
 
 /**
@@ -541,80 +363,152 @@
 
 /**
  * @internal
- * @brief Formats ResourceAtUriInUnknownFormat message into JSON
+ * @brief Formats PropertyValueError message into JSON
  *
  * See header file for more information
  * @endinternal
  */
-nlohmann::json
-    resourceAtUriInUnknownFormat(const boost::urls::url_view_base& arg1)
+nlohmann::json propertyValueError(std::string_view arg1)
 {
-    return getLog(
-        redfish::registries::base::Index::resourceAtUriInUnknownFormat,
-        std::to_array<std::string_view>({arg1.buffer()}));
-}
-
-void resourceAtUriInUnknownFormat(crow::Response& res,
-                                  const boost::urls::url_view_base& arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1));
-}
-
-/**
- * @internal
- * @brief Formats ServiceDisabled message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json serviceDisabled(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::serviceDisabled,
+    return getLog(redfish::registries::base::Index::propertyValueError,
                   std::to_array({arg1}));
 }
 
-void serviceDisabled(crow::Response& res, std::string_view arg1)
+void propertyValueError(crow::Response& res, std::string_view arg1)
 {
-    res.result(boost::beast::http::status::service_unavailable);
-    addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1));
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToJson(res.jsonValue, propertyValueError(arg1), arg1);
 }
 
 /**
  * @internal
- * @brief Formats ServiceInUnknownState message into JSON
+ * @brief Formats PropertyNotWritable message into JSON
  *
  * See header file for more information
  * @endinternal
  */
-nlohmann::json serviceInUnknownState()
+nlohmann::json propertyNotWritable(std::string_view arg1)
 {
-    return getLog(redfish::registries::base::Index::serviceInUnknownState, {});
+    return getLog(redfish::registries::base::Index::propertyNotWritable,
+                  std::to_array({arg1}));
 }
 
-void serviceInUnknownState(crow::Response& res)
+void propertyNotWritable(crow::Response& res, std::string_view arg1)
 {
-    res.result(boost::beast::http::status::service_unavailable);
-    addMessageToErrorJson(res.jsonValue, serviceInUnknownState());
+    res.result(boost::beast::http::status::forbidden);
+    addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1);
 }
 
 /**
  * @internal
- * @brief Formats EventSubscriptionLimitExceeded message into JSON
+ * @brief Formats PropertyNotUpdated message into JSON
  *
  * See header file for more information
  * @endinternal
  */
-nlohmann::json eventSubscriptionLimitExceeded()
+nlohmann::json propertyNotUpdated(std::string_view arg1)
 {
-    return getLog(
-        redfish::registries::base::Index::eventSubscriptionLimitExceeded, {});
+    return getLog(redfish::registries::base::Index::propertyNotUpdated,
+                  std::to_array({arg1}));
 }
 
-void eventSubscriptionLimitExceeded(crow::Response& res)
+void propertyNotUpdated(crow::Response& res, std::string_view arg1)
 {
-    res.result(boost::beast::http::status::service_unavailable);
-    addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded());
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, propertyNotUpdated(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats PropertyMissing message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json propertyMissing(std::string_view arg1)
+{
+    return getLog(redfish::registries::base::Index::propertyMissing,
+                  std::to_array({arg1}));
+}
+
+void propertyMissing(crow::Response& res, std::string_view arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1);
+}
+
+/**
+ * @internal
+ * @brief Formats MalformedJSON message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json malformedJSON()
+{
+    return getLog(redfish::registries::base::Index::malformedJSON, {});
+}
+
+void malformedJSON(crow::Response& res)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, malformedJSON());
+}
+
+/**
+ * @internal
+ * @brief Formats InvalidJSON message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json invalidJSON(std::string_view arg1)
+{
+    return getLog(redfish::registries::base::Index::invalidJSON,
+                  std::to_array({arg1}));
+}
+
+void invalidJSON(crow::Response& res, std::string_view arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, invalidJSON(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats EmptyJSON message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json emptyJSON()
+{
+    return getLog(redfish::registries::base::Index::emptyJSON, {});
+}
+
+void emptyJSON(crow::Response& res)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, emptyJSON());
+}
+
+/**
+ * @internal
+ * @brief Formats ActionNotSupported message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json actionNotSupported(std::string_view arg1)
+{
+    return getLog(redfish::registries::base::Index::actionNotSupported,
+                  std::to_array({arg1}));
+}
+
+void actionNotSupported(crow::Response& res, std::string_view arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1));
 }
 
 /**
@@ -640,6 +534,1080 @@
 
 /**
  * @internal
+ * @brief Formats ActionParameterDuplicate message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json actionParameterDuplicate(std::string_view arg1,
+                                        std::string_view arg2)
+{
+    return getLog(redfish::registries::base::Index::actionParameterDuplicate,
+                  std::to_array({arg1, arg2}));
+}
+
+void actionParameterDuplicate(crow::Response& res, std::string_view arg1,
+                              std::string_view arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2));
+}
+
+/**
+ * @internal
+ * @brief Formats ActionParameterUnknown message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json actionParameterUnknown(std::string_view arg1,
+                                      std::string_view arg2)
+{
+    return getLog(redfish::registries::base::Index::actionParameterUnknown,
+                  std::to_array({arg1, arg2}));
+}
+
+void actionParameterUnknown(crow::Response& res, std::string_view arg1,
+                            std::string_view arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, actionParameterUnknown(arg1, arg2));
+}
+
+/**
+ * @internal
+ * @brief Formats ActionParameterValueTypeError message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json actionParameterValueTypeError(
+    const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3)
+{
+    std::string arg1Str =
+        arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
+    return getLog(
+        redfish::registries::base::Index::actionParameterValueTypeError,
+        std::to_array<std::string_view>({arg1Str, arg2, arg3}));
+}
+
+void actionParameterValueTypeError(crow::Response& res,
+                                   const nlohmann::json& arg1,
+                                   std::string_view arg2, std::string_view arg3)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue,
+                          actionParameterValueTypeError(arg1, arg2, arg3));
+}
+
+/**
+ * @internal
+ * @brief Formats ActionParameterValueFormatError message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json actionParameterValueFormatError(
+    const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3)
+{
+    std::string arg1Str =
+        arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
+    return getLog(
+        redfish::registries::base::Index::actionParameterValueFormatError,
+        std::to_array<std::string_view>({arg1Str, arg2, arg3}));
+}
+
+void actionParameterValueFormatError(
+    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2,
+    std::string_view arg3)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue,
+                          actionParameterValueFormatError(arg1, arg2, arg3));
+}
+
+/**
+ * @internal
+ * @brief Formats ActionParameterValueNotInList message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json actionParameterValueNotInList(
+    std::string_view arg1, std::string_view arg2, std::string_view arg3)
+{
+    return getLog(
+        redfish::registries::base::Index::actionParameterValueNotInList,
+        std::to_array({arg1, arg2, arg3}));
+}
+
+void actionParameterValueNotInList(crow::Response& res, std::string_view arg1,
+                                   std::string_view arg2, std::string_view arg3)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue,
+                          actionParameterValueNotInList(arg1, arg2, arg3));
+}
+
+/**
+ * @internal
+ * @brief Formats ActionParameterValueOutOfRange message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json actionParameterValueOutOfRange(
+    std::string_view arg1, std::string_view arg2, std::string_view arg3)
+{
+    return getLog(
+        redfish::registries::base::Index::actionParameterValueOutOfRange,
+        std::to_array({arg1, arg2, arg3}));
+}
+
+void actionParameterValueOutOfRange(crow::Response& res, std::string_view arg1,
+                                    std::string_view arg2,
+                                    std::string_view arg3)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue,
+                          actionParameterValueOutOfRange(arg1, arg2, arg3));
+}
+
+/**
+ * @internal
+ * @brief Formats ActionParameterValueError message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json actionParameterValueError(const nlohmann::json& arg1,
+                                         std::string_view arg2)
+{
+    std::string arg1Str =
+        arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
+    return getLog(redfish::registries::base::Index::actionParameterValueError,
+                  std::to_array<std::string_view>({arg1Str, arg2}));
+}
+
+void actionParameterValueError(crow::Response& res, const nlohmann::json& arg1,
+                               std::string_view arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, actionParameterValueError(arg1, arg2));
+}
+
+/**
+ * @internal
+ * @brief Formats ActionParameterNotSupported message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json actionParameterNotSupported(std::string_view arg1,
+                                           std::string_view arg2)
+{
+    return getLog(redfish::registries::base::Index::actionParameterNotSupported,
+                  std::to_array({arg1, arg2}));
+}
+
+void actionParameterNotSupported(crow::Response& res, std::string_view arg1,
+                                 std::string_view arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue,
+                          actionParameterNotSupported(arg1, arg2));
+}
+
+/**
+ * @internal
+ * @brief Formats ArraySizeTooLong message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json arraySizeTooLong(std::string_view arg1, uint64_t arg2)
+{
+    std::string arg2Str = std::to_string(arg2);
+    return getLog(redfish::registries::base::Index::arraySizeTooLong,
+                  std::to_array<std::string_view>({arg1, arg2Str}));
+}
+
+void arraySizeTooLong(crow::Response& res, std::string_view arg1, uint64_t arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, arraySizeTooLong(arg1, arg2));
+}
+
+/**
+ * @internal
+ * @brief Formats ArraySizeTooShort message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json arraySizeTooShort(std::string_view arg1, std::string_view arg2)
+{
+    return getLog(redfish::registries::base::Index::arraySizeTooShort,
+                  std::to_array({arg1, arg2}));
+}
+
+void arraySizeTooShort(crow::Response& res, std::string_view arg1,
+                       std::string_view arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, arraySizeTooShort(arg1, arg2));
+}
+
+/**
+ * @internal
+ * @brief Formats QueryParameterValueTypeError message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json queryParameterValueTypeError(const nlohmann::json& arg1,
+                                            std::string_view arg2)
+{
+    std::string arg1Str =
+        arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
+    return getLog(
+        redfish::registries::base::Index::queryParameterValueTypeError,
+        std::to_array<std::string_view>({arg1Str, arg2}));
+}
+
+void queryParameterValueTypeError(
+    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue,
+                          queryParameterValueTypeError(arg1, arg2));
+}
+
+/**
+ * @internal
+ * @brief Formats QueryParameterValueFormatError message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json queryParameterValueFormatError(const nlohmann::json& arg1,
+                                              std::string_view arg2)
+{
+    std::string arg1Str =
+        arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
+    return getLog(
+        redfish::registries::base::Index::queryParameterValueFormatError,
+        std::to_array<std::string_view>({arg1Str, arg2}));
+}
+
+void queryParameterValueFormatError(
+    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue,
+                          queryParameterValueFormatError(arg1, arg2));
+}
+
+/**
+ * @internal
+ * @brief Formats QueryParameterValueError message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json queryParameterValueError(std::string_view arg1)
+{
+    return getLog(redfish::registries::base::Index::queryParameterValueError,
+                  std::to_array({arg1}));
+}
+
+void queryParameterValueError(crow::Response& res, std::string_view arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, queryParameterValueError(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats QueryParameterOutOfRange message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json queryParameterOutOfRange(
+    std::string_view arg1, std::string_view arg2, std::string_view arg3)
+{
+    return getLog(redfish::registries::base::Index::queryParameterOutOfRange,
+                  std::to_array({arg1, arg2, arg3}));
+}
+
+void queryParameterOutOfRange(crow::Response& res, std::string_view arg1,
+                              std::string_view arg2, std::string_view arg3)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue,
+                          queryParameterOutOfRange(arg1, arg2, arg3));
+}
+
+/**
+ * @internal
+ * @brief Formats QueryNotSupportedOnResource message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json queryNotSupportedOnResource()
+{
+    return getLog(redfish::registries::base::Index::queryNotSupportedOnResource,
+                  {});
+}
+
+void queryNotSupportedOnResource(crow::Response& res)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource());
+}
+
+/**
+ * @internal
+ * @brief Formats QueryNotSupportedOnOperation message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json queryNotSupportedOnOperation()
+{
+    return getLog(
+        redfish::registries::base::Index::queryNotSupportedOnOperation, {});
+}
+
+void queryNotSupportedOnOperation(crow::Response& res)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation());
+}
+
+/**
+ * @internal
+ * @brief Formats QueryNotSupported message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json queryNotSupported()
+{
+    return getLog(redfish::registries::base::Index::queryNotSupported, {});
+}
+
+void queryNotSupported(crow::Response& res)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, queryNotSupported());
+}
+
+/**
+ * @internal
+ * @brief Formats QueryCombinationInvalid message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json queryCombinationInvalid()
+{
+    return getLog(redfish::registries::base::Index::queryCombinationInvalid,
+                  {});
+}
+
+void queryCombinationInvalid(crow::Response& res)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, queryCombinationInvalid());
+}
+
+/**
+ * @internal
+ * @brief Formats QueryParameterUnsupported message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json queryParameterUnsupported(std::string_view arg1)
+{
+    return getLog(redfish::registries::base::Index::queryParameterUnsupported,
+                  std::to_array({arg1}));
+}
+
+void queryParameterUnsupported(crow::Response& res, std::string_view arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, queryParameterUnsupported(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats SessionLimitExceeded message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json sessionLimitExceeded()
+{
+    return getLog(redfish::registries::base::Index::sessionLimitExceeded, {});
+}
+
+void sessionLimitExceeded(crow::Response& res)
+{
+    res.result(boost::beast::http::status::service_unavailable);
+    addMessageToErrorJson(res.jsonValue, sessionLimitExceeded());
+}
+
+/**
+ * @internal
+ * @brief Formats EventSubscriptionLimitExceeded message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json eventSubscriptionLimitExceeded()
+{
+    return getLog(
+        redfish::registries::base::Index::eventSubscriptionLimitExceeded, {});
+}
+
+void eventSubscriptionLimitExceeded(crow::Response& res)
+{
+    res.result(boost::beast::http::status::service_unavailable);
+    addMessageToErrorJson(res.jsonValue, eventSubscriptionLimitExceeded());
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceCannotBeDeleted message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceCannotBeDeleted()
+{
+    return getLog(redfish::registries::base::Index::resourceCannotBeDeleted,
+                  {});
+}
+
+void resourceCannotBeDeleted(crow::Response& res)
+{
+    res.result(boost::beast::http::status::method_not_allowed);
+    addMessageToErrorJson(res.jsonValue, resourceCannotBeDeleted());
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceInUse message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceInUse()
+{
+    return getLog(redfish::registries::base::Index::resourceInUse, {});
+}
+
+void resourceInUse(crow::Response& res)
+{
+    res.result(boost::beast::http::status::service_unavailable);
+    addMessageToErrorJson(res.jsonValue, resourceInUse());
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceAlreadyExists message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceAlreadyExists(
+    std::string_view arg1, std::string_view arg2, std::string_view arg3)
+{
+    return getLog(redfish::registries::base::Index::resourceAlreadyExists,
+                  std::to_array({arg1, arg2, arg3}));
+}
+
+void resourceAlreadyExists(crow::Response& res, std::string_view arg1,
+                           std::string_view arg2, std::string_view arg3)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToJson(res.jsonValue, resourceAlreadyExists(arg1, arg2, arg3),
+                     arg2);
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceNotFound message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2)
+{
+    return getLog(redfish::registries::base::Index::resourceNotFound,
+                  std::to_array({arg1, arg2}));
+}
+
+void resourceNotFound(crow::Response& res, std::string_view arg1,
+                      std::string_view arg2)
+{
+    res.result(boost::beast::http::status::not_found);
+    addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2));
+}
+
+/**
+ * @internal
+ * @brief Formats PayloadTooLarge message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json payloadTooLarge()
+{
+    return getLog(redfish::registries::base::Index::payloadTooLarge, {});
+}
+
+void payloadTooLarge(crow::Response& res)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, payloadTooLarge());
+}
+
+/**
+ * @internal
+ * @brief Formats InsufficientStorage message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json insufficientStorage()
+{
+    return getLog(redfish::registries::base::Index::insufficientStorage, {});
+}
+
+void insufficientStorage(crow::Response& res)
+{
+    res.result(boost::beast::http::status::insufficient_storage);
+    addMessageToErrorJson(res.jsonValue, insufficientStorage());
+}
+
+/**
+ * @internal
+ * @brief Formats MissingOrMalformedPart message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json missingOrMalformedPart()
+{
+    return getLog(redfish::registries::base::Index::missingOrMalformedPart, {});
+}
+
+void missingOrMalformedPart(crow::Response& res)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, missingOrMalformedPart());
+}
+
+/**
+ * @internal
+ * @brief Formats InvalidURI message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json invalidURI(std::string_view arg1)
+{
+    return getLog(redfish::registries::base::Index::invalidURI,
+                  std::to_array({arg1}));
+}
+
+void invalidURI(crow::Response& res, std::string_view arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, invalidURI(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats CreateFailedMissingReqProperties message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json createFailedMissingReqProperties(std::string_view arg1)
+{
+    return getLog(
+        redfish::registries::base::Index::createFailedMissingReqProperties,
+        std::to_array({arg1}));
+}
+
+void createFailedMissingReqProperties(crow::Response& res,
+                                      std::string_view arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToJson(res.jsonValue, createFailedMissingReqProperties(arg1),
+                     arg1);
+}
+
+/**
+ * @internal
+ * @brief Formats CreateLimitReachedForResource message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json createLimitReachedForResource()
+{
+    return getLog(
+        redfish::registries::base::Index::createLimitReachedForResource, {});
+}
+
+void createLimitReachedForResource(crow::Response& res)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, createLimitReachedForResource());
+}
+
+/**
+ * @internal
+ * @brief Formats ServiceShuttingDown message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json serviceShuttingDown()
+{
+    return getLog(redfish::registries::base::Index::serviceShuttingDown, {});
+}
+
+void serviceShuttingDown(crow::Response& res)
+{
+    res.result(boost::beast::http::status::service_unavailable);
+    addMessageToErrorJson(res.jsonValue, serviceShuttingDown());
+}
+
+/**
+ * @internal
+ * @brief Formats ServiceInUnknownState message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json serviceInUnknownState()
+{
+    return getLog(redfish::registries::base::Index::serviceInUnknownState, {});
+}
+
+void serviceInUnknownState(crow::Response& res)
+{
+    res.result(boost::beast::http::status::service_unavailable);
+    addMessageToErrorJson(res.jsonValue, serviceInUnknownState());
+}
+
+/**
+ * @internal
+ * @brief Formats NoValidSession message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json noValidSession()
+{
+    return getLog(redfish::registries::base::Index::noValidSession, {});
+}
+
+void noValidSession(crow::Response& res)
+{
+    res.result(boost::beast::http::status::forbidden);
+    addMessageToErrorJson(res.jsonValue, noValidSession());
+}
+
+/**
+ * @internal
+ * @brief Formats InsufficientPrivilege message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json insufficientPrivilege()
+{
+    return getLog(redfish::registries::base::Index::insufficientPrivilege, {});
+}
+
+void insufficientPrivilege(crow::Response& res)
+{
+    res.result(boost::beast::http::status::forbidden);
+    addMessageToErrorJson(res.jsonValue, insufficientPrivilege());
+}
+
+/**
+ * @internal
+ * @brief Formats AccountModified message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json accountModified()
+{
+    return getLog(redfish::registries::base::Index::accountModified, {});
+}
+
+void accountModified(crow::Response& res)
+{
+    res.result(boost::beast::http::status::ok);
+    addMessageToErrorJson(res.jsonValue, accountModified());
+}
+
+/**
+ * @internal
+ * @brief Formats AccountNotModified message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json accountNotModified()
+{
+    return getLog(redfish::registries::base::Index::accountNotModified, {});
+}
+
+void accountNotModified(crow::Response& res)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, accountNotModified());
+}
+
+/**
+ * @internal
+ * @brief Formats AccountRemoved message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json accountRemoved()
+{
+    return getLog(redfish::registries::base::Index::accountRemoved, {});
+}
+
+void accountRemoved(crow::Response& res)
+{
+    res.result(boost::beast::http::status::ok);
+    addMessageToJsonRoot(res.jsonValue, accountRemoved());
+}
+
+/**
+ * @internal
+ * @brief Formats AccountForSessionNoLongerExists message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json accountForSessionNoLongerExists()
+{
+    return getLog(
+        redfish::registries::base::Index::accountForSessionNoLongerExists, {});
+}
+
+void accountForSessionNoLongerExists(crow::Response& res)
+{
+    res.result(boost::beast::http::status::forbidden);
+    addMessageToErrorJson(res.jsonValue, accountForSessionNoLongerExists());
+}
+
+/**
+ * @internal
+ * @brief Formats InvalidObject message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json invalidObject(const boost::urls::url_view_base& arg1)
+{
+    return getLog(redfish::registries::base::Index::invalidObject,
+                  std::to_array<std::string_view>({arg1.buffer()}));
+}
+
+void invalidObject(crow::Response& res, const boost::urls::url_view_base& arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, invalidObject(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats InternalError message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json internalError()
+{
+    return getLog(redfish::registries::base::Index::internalError, {});
+}
+
+void internalError(crow::Response& res, const std::source_location location)
+{
+    BMCWEB_LOG_CRITICAL("Internal Error {}({}:{}) `{}`: ", location.file_name(),
+                        location.line(), location.column(),
+                        location.function_name());
+    res.result(boost::beast::http::status::internal_server_error);
+    addMessageToErrorJson(res.jsonValue, internalError());
+}
+
+/**
+ * @internal
+ * @brief Formats UnrecognizedRequestBody message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json unrecognizedRequestBody()
+{
+    return getLog(redfish::registries::base::Index::unrecognizedRequestBody,
+                  {});
+}
+
+void unrecognizedRequestBody(crow::Response& res)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, unrecognizedRequestBody());
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceMissingAtURI message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceMissingAtURI(const boost::urls::url_view_base& arg1)
+{
+    return getLog(redfish::registries::base::Index::resourceMissingAtURI,
+                  std::to_array<std::string_view>({arg1.buffer()}));
+}
+
+void resourceMissingAtURI(crow::Response& res,
+                          const boost::urls::url_view_base& arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceAtUriInUnknownFormat message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json
+    resourceAtUriInUnknownFormat(const boost::urls::url_view_base& arg1)
+{
+    return getLog(
+        redfish::registries::base::Index::resourceAtUriInUnknownFormat,
+        std::to_array<std::string_view>({arg1.buffer()}));
+}
+
+void resourceAtUriInUnknownFormat(crow::Response& res,
+                                  const boost::urls::url_view_base& arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceAtUriUnauthorized message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view_base& arg1,
+                                         std::string_view arg2)
+{
+    return getLog(redfish::registries::base::Index::resourceAtUriUnauthorized,
+                  std::to_array<std::string_view>({arg1.buffer(), arg2}));
+}
+
+void resourceAtUriUnauthorized(crow::Response& res,
+                               const boost::urls::url_view_base& arg1,
+                               std::string_view arg2)
+{
+    res.result(boost::beast::http::status::unauthorized);
+    addMessageToErrorJson(res.jsonValue, resourceAtUriUnauthorized(arg1, arg2));
+}
+
+/**
+ * @internal
+ * @brief Formats CouldNotEstablishConnection message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json
+    couldNotEstablishConnection(const boost::urls::url_view_base& arg1)
+{
+    return getLog(redfish::registries::base::Index::couldNotEstablishConnection,
+                  std::to_array<std::string_view>({arg1.buffer()}));
+}
+
+void couldNotEstablishConnection(crow::Response& res,
+                                 const boost::urls::url_view_base& arg1)
+{
+    res.result(boost::beast::http::status::not_found);
+    addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats SourceDoesNotSupportProtocol message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json sourceDoesNotSupportProtocol(
+    const boost::urls::url_view_base& arg1, std::string_view arg2)
+{
+    return getLog(
+        redfish::registries::base::Index::sourceDoesNotSupportProtocol,
+        std::to_array<std::string_view>({arg1.buffer(), arg2}));
+}
+
+void sourceDoesNotSupportProtocol(crow::Response& res,
+                                  const boost::urls::url_view_base& arg1,
+                                  std::string_view arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue,
+                          sourceDoesNotSupportProtocol(arg1, arg2));
+}
+
+/**
+ * @internal
+ * @brief Formats AccessDenied message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json accessDenied(const boost::urls::url_view_base& arg1)
+{
+    return getLog(redfish::registries::base::Index::accessDenied,
+                  std::to_array<std::string_view>({arg1.buffer()}));
+}
+
+void accessDenied(crow::Response& res, const boost::urls::url_view_base& arg1)
+{
+    res.result(boost::beast::http::status::forbidden);
+    addMessageToErrorJson(res.jsonValue, accessDenied(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats ServiceTemporarilyUnavailable message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json serviceTemporarilyUnavailable(std::string_view arg1)
+{
+    return getLog(
+        redfish::registries::base::Index::serviceTemporarilyUnavailable,
+        std::to_array({arg1}));
+}
+
+void serviceTemporarilyUnavailable(crow::Response& res, std::string_view arg1)
+{
+    res.addHeader(boost::beast::http::field::retry_after, arg1);
+    res.result(boost::beast::http::status::service_unavailable);
+    addMessageToErrorJson(res.jsonValue, serviceTemporarilyUnavailable(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats InvalidIndex message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json invalidIndex(int64_t arg1)
+{
+    std::string arg1Str = std::to_string(arg1);
+    return getLog(redfish::registries::base::Index::invalidIndex,
+                  std::to_array<std::string_view>({arg1Str}));
+}
+
+void invalidIndex(crow::Response& res, int64_t arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, invalidIndex(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats PropertyValueModified message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json propertyValueModified(std::string_view arg1,
+                                     const nlohmann::json& arg2)
+{
+    std::string arg2Str =
+        arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
+    return getLog(redfish::registries::base::Index::propertyValueModified,
+                  std::to_array<std::string_view>({arg1, arg2Str}));
+}
+
+void propertyValueModified(crow::Response& res, std::string_view arg1,
+                           const nlohmann::json& arg2)
+{
+    res.result(boost::beast::http::status::ok);
+    addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1);
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceInStandby message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceInStandby()
+{
+    return getLog(redfish::registries::base::Index::resourceInStandby, {});
+}
+
+void resourceInStandby(crow::Response& res)
+{
+    res.result(boost::beast::http::status::service_unavailable);
+    addMessageToErrorJson(res.jsonValue, resourceInStandby());
+}
+
+/**
+ * @internal
+ * @brief Formats ResourceExhaustion message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resourceExhaustion(std::string_view arg1)
+{
+    return getLog(redfish::registries::base::Index::resourceExhaustion,
+                  std::to_array({arg1}));
+}
+
+void resourceExhaustion(crow::Response& res, std::string_view arg1)
+{
+    res.result(boost::beast::http::status::service_unavailable);
+    addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1));
+}
+
+/**
+ * @internal
  * @brief Formats StringValueTooLong message into JSON
  *
  * See header file for more information
@@ -660,6 +1628,26 @@
 
 /**
  * @internal
+ * @brief Formats StringValueTooShort message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json stringValueTooShort(std::string_view arg1, std::string_view arg2)
+{
+    return getLog(redfish::registries::base::Index::stringValueTooShort,
+                  std::to_array({arg1, arg2}));
+}
+
+void stringValueTooShort(crow::Response& res, std::string_view arg1,
+                         std::string_view arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, stringValueTooShort(arg1, arg2));
+}
+
+/**
+ * @internal
  * @brief Formats SessionTerminated message into JSON
  *
  * See header file for more information
@@ -717,6 +1705,25 @@
 
 /**
  * @internal
+ * @brief Formats PasswordChangeRequired message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json passwordChangeRequired(const boost::urls::url_view_base& arg1)
+{
+    return getLog(redfish::registries::base::Index::passwordChangeRequired,
+                  std::to_array<std::string_view>({arg1.buffer()}));
+}
+
+void passwordChangeRequired(crow::Response& res,
+                            const boost::urls::url_view_base& arg1)
+{
+    addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1));
+}
+
+/**
+ * @internal
  * @brief Formats ResetRequired message into JSON
  *
  * See header file for more information
@@ -738,6 +1745,26 @@
 
 /**
  * @internal
+ * @brief Formats ResetRecommended message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json resetRecommended(std::string_view arg1, std::string_view arg2)
+{
+    return getLog(redfish::registries::base::Index::resetRecommended,
+                  std::to_array({arg1, arg2}));
+}
+
+void resetRecommended(crow::Response& res, std::string_view arg1,
+                      std::string_view arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, resetRecommended(arg1, arg2));
+}
+
+/**
+ * @internal
  * @brief Formats ChassisPowerStateOnRequired message into JSON
  *
  * See header file for more information
@@ -893,6 +1920,29 @@
 
 /**
  * @internal
+ * @brief Formats ActionParameterValueConflict message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json
+    actionParameterValueConflict(std::string_view arg1, std::string_view arg2)
+{
+    return getLog(
+        redfish::registries::base::Index::actionParameterValueConflict,
+        std::to_array({arg1, arg2}));
+}
+
+void actionParameterValueConflict(crow::Response& res, std::string_view arg1,
+                                  std::string_view arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue,
+                          actionParameterValueConflict(arg1, arg2));
+}
+
+/**
+ * @internal
  * @brief Formats MaximumErrorsExceeded message into JSON
  *
  * See header file for more information
@@ -947,6 +1997,44 @@
 
 /**
  * @internal
+ * @brief Formats HeaderMissing message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json headerMissing(std::string_view arg1)
+{
+    return getLog(redfish::registries::base::Index::headerMissing,
+                  std::to_array({arg1}));
+}
+
+void headerMissing(crow::Response& res, std::string_view arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, headerMissing(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats HeaderInvalid message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json headerInvalid(std::string_view arg1)
+{
+    return getLog(redfish::registries::base::Index::headerInvalid,
+                  std::to_array({arg1}));
+}
+
+void headerInvalid(crow::Response& res, std::string_view arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, headerInvalid(arg1));
+}
+
+/**
+ * @internal
  * @brief Formats OperationFailed message into JSON
  *
  * See header file for more information
@@ -983,854 +2071,6 @@
 
 /**
  * @internal
- * @brief Formats PropertyValueTypeError message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json propertyValueTypeError(const nlohmann::json& arg1,
-                                      std::string_view arg2)
-{
-    std::string arg1Str =
-        arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
-    return getLog(redfish::registries::base::Index::propertyValueTypeError,
-                  std::to_array<std::string_view>({arg1Str, arg2}));
-}
-
-void propertyValueTypeError(crow::Response& res, const nlohmann::json& arg1,
-                            std::string_view arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToJson(res.jsonValue, propertyValueTypeError(arg1, arg2), arg2);
-}
-
-/**
- * @internal
- * @brief Formats PropertyValueError message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json propertyValueError(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::propertyValueError,
-                  std::to_array({arg1}));
-}
-
-void propertyValueError(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToJson(res.jsonValue, propertyValueError(arg1), arg1);
-}
-
-/**
- * @internal
- * @brief Formats ResourceNotFound message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json resourceNotFound(std::string_view arg1, std::string_view arg2)
-{
-    return getLog(redfish::registries::base::Index::resourceNotFound,
-                  std::to_array({arg1, arg2}));
-}
-
-void resourceNotFound(crow::Response& res, std::string_view arg1,
-                      std::string_view arg2)
-{
-    res.result(boost::beast::http::status::not_found);
-    addMessageToErrorJson(res.jsonValue, resourceNotFound(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats CouldNotEstablishConnection message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json
-    couldNotEstablishConnection(const boost::urls::url_view_base& arg1)
-{
-    return getLog(redfish::registries::base::Index::couldNotEstablishConnection,
-                  std::to_array<std::string_view>({arg1.buffer()}));
-}
-
-void couldNotEstablishConnection(crow::Response& res,
-                                 const boost::urls::url_view_base& arg1)
-{
-    res.result(boost::beast::http::status::not_found);
-    addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1));
-}
-
-/**
- * @internal
- * @brief Formats PropertyNotWritable message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json propertyNotWritable(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::propertyNotWritable,
-                  std::to_array({arg1}));
-}
-
-void propertyNotWritable(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::forbidden);
-    addMessageToJson(res.jsonValue, propertyNotWritable(arg1), arg1);
-}
-
-/**
- * @internal
- * @brief Formats QueryParameterValueTypeError message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json queryParameterValueTypeError(const nlohmann::json& arg1,
-                                            std::string_view arg2)
-{
-    std::string arg1Str =
-        arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
-    return getLog(
-        redfish::registries::base::Index::queryParameterValueTypeError,
-        std::to_array<std::string_view>({arg1Str, arg2}));
-}
-
-void queryParameterValueTypeError(
-    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue,
-                          queryParameterValueTypeError(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats ServiceShuttingDown message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json serviceShuttingDown()
-{
-    return getLog(redfish::registries::base::Index::serviceShuttingDown, {});
-}
-
-void serviceShuttingDown(crow::Response& res)
-{
-    res.result(boost::beast::http::status::service_unavailable);
-    addMessageToErrorJson(res.jsonValue, serviceShuttingDown());
-}
-
-/**
- * @internal
- * @brief Formats ActionParameterDuplicate message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json actionParameterDuplicate(std::string_view arg1,
-                                        std::string_view arg2)
-{
-    return getLog(redfish::registries::base::Index::actionParameterDuplicate,
-                  std::to_array({arg1, arg2}));
-}
-
-void actionParameterDuplicate(crow::Response& res, std::string_view arg1,
-                              std::string_view arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, actionParameterDuplicate(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats ActionParameterNotSupported message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json actionParameterNotSupported(std::string_view arg1,
-                                           std::string_view arg2)
-{
-    return getLog(redfish::registries::base::Index::actionParameterNotSupported,
-                  std::to_array({arg1, arg2}));
-}
-
-void actionParameterNotSupported(crow::Response& res, std::string_view arg1,
-                                 std::string_view arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue,
-                          actionParameterNotSupported(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats SourceDoesNotSupportProtocol message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json sourceDoesNotSupportProtocol(
-    const boost::urls::url_view_base& arg1, std::string_view arg2)
-{
-    return getLog(
-        redfish::registries::base::Index::sourceDoesNotSupportProtocol,
-        std::to_array<std::string_view>({arg1.buffer(), arg2}));
-}
-
-void sourceDoesNotSupportProtocol(crow::Response& res,
-                                  const boost::urls::url_view_base& arg1,
-                                  std::string_view arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue,
-                          sourceDoesNotSupportProtocol(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats StrictAccountTypes message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json strictAccountTypes(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::strictAccountTypes,
-                  std::to_array({arg1}));
-}
-
-void strictAccountTypes(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1));
-}
-
-/**
- * @internal
- * @brief Formats AccountRemoved message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json accountRemoved()
-{
-    return getLog(redfish::registries::base::Index::accountRemoved, {});
-}
-
-void accountRemoved(crow::Response& res)
-{
-    res.result(boost::beast::http::status::ok);
-    addMessageToJsonRoot(res.jsonValue, accountRemoved());
-}
-
-/**
- * @internal
- * @brief Formats AccessDenied message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json accessDenied(const boost::urls::url_view_base& arg1)
-{
-    return getLog(redfish::registries::base::Index::accessDenied,
-                  std::to_array<std::string_view>({arg1.buffer()}));
-}
-
-void accessDenied(crow::Response& res, const boost::urls::url_view_base& arg1)
-{
-    res.result(boost::beast::http::status::forbidden);
-    addMessageToErrorJson(res.jsonValue, accessDenied(arg1));
-}
-
-/**
- * @internal
- * @brief Formats QueryNotSupported message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json queryNotSupported()
-{
-    return getLog(redfish::registries::base::Index::queryNotSupported, {});
-}
-
-void queryNotSupported(crow::Response& res)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, queryNotSupported());
-}
-
-/**
- * @internal
- * @brief Formats CreateLimitReachedForResource message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json createLimitReachedForResource()
-{
-    return getLog(
-        redfish::registries::base::Index::createLimitReachedForResource, {});
-}
-
-void createLimitReachedForResource(crow::Response& res)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, createLimitReachedForResource());
-}
-
-/**
- * @internal
- * @brief Formats GeneralError message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json generalError()
-{
-    return getLog(redfish::registries::base::Index::generalError, {});
-}
-
-void generalError(crow::Response& res)
-{
-    res.result(boost::beast::http::status::internal_server_error);
-    addMessageToErrorJson(res.jsonValue, generalError());
-}
-
-/**
- * @internal
- * @brief Formats Success message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json success()
-{
-    return getLog(redfish::registries::base::Index::success, {});
-}
-
-void success(crow::Response& res)
-{
-    addMessageToJsonRoot(res.jsonValue, success());
-}
-
-/**
- * @internal
- * @brief Formats Created message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json created()
-{
-    return getLog(redfish::registries::base::Index::created, {});
-}
-
-void created(crow::Response& res)
-{
-    res.result(boost::beast::http::status::created);
-    addMessageToJsonRoot(res.jsonValue, created());
-}
-
-/**
- * @internal
- * @brief Formats NoOperation message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json noOperation()
-{
-    return getLog(redfish::registries::base::Index::noOperation, {});
-}
-
-void noOperation(crow::Response& res)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, noOperation());
-}
-
-/**
- * @internal
- * @brief Formats PropertyUnknown message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json propertyUnknown(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::propertyUnknown,
-                  std::to_array({arg1}));
-}
-
-void propertyUnknown(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, propertyUnknown(arg1));
-}
-
-/**
- * @internal
- * @brief Formats NoValidSession message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json noValidSession()
-{
-    return getLog(redfish::registries::base::Index::noValidSession, {});
-}
-
-void noValidSession(crow::Response& res)
-{
-    res.result(boost::beast::http::status::forbidden);
-    addMessageToErrorJson(res.jsonValue, noValidSession());
-}
-
-/**
- * @internal
- * @brief Formats InvalidObject message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json invalidObject(const boost::urls::url_view_base& arg1)
-{
-    return getLog(redfish::registries::base::Index::invalidObject,
-                  std::to_array<std::string_view>({arg1.buffer()}));
-}
-
-void invalidObject(crow::Response& res, const boost::urls::url_view_base& arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, invalidObject(arg1));
-}
-
-/**
- * @internal
- * @brief Formats ResourceInStandby message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json resourceInStandby()
-{
-    return getLog(redfish::registries::base::Index::resourceInStandby, {});
-}
-
-void resourceInStandby(crow::Response& res)
-{
-    res.result(boost::beast::http::status::service_unavailable);
-    addMessageToErrorJson(res.jsonValue, resourceInStandby());
-}
-
-/**
- * @internal
- * @brief Formats ActionParameterValueTypeError message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json actionParameterValueTypeError(
-    const nlohmann::json& arg1, std::string_view arg2, std::string_view arg3)
-{
-    std::string arg1Str =
-        arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
-    return getLog(
-        redfish::registries::base::Index::actionParameterValueTypeError,
-        std::to_array<std::string_view>({arg1Str, arg2, arg3}));
-}
-
-void actionParameterValueTypeError(crow::Response& res,
-                                   const nlohmann::json& arg1,
-                                   std::string_view arg2, std::string_view arg3)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue,
-                          actionParameterValueTypeError(arg1, arg2, arg3));
-}
-
-/**
- * @internal
- * @brief Formats ActionParameterValueError message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json actionParameterValueError(const nlohmann::json& arg1,
-                                         std::string_view arg2)
-{
-    std::string arg1Str =
-        arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
-    return getLog(redfish::registries::base::Index::actionParameterValueError,
-                  std::to_array<std::string_view>({arg1Str, arg2}));
-}
-
-void actionParameterValueError(crow::Response& res, const nlohmann::json& arg1,
-                               std::string_view arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, actionParameterValueError(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats SessionLimitExceeded message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json sessionLimitExceeded()
-{
-    return getLog(redfish::registries::base::Index::sessionLimitExceeded, {});
-}
-
-void sessionLimitExceeded(crow::Response& res)
-{
-    res.result(boost::beast::http::status::service_unavailable);
-    addMessageToErrorJson(res.jsonValue, sessionLimitExceeded());
-}
-
-/**
- * @internal
- * @brief Formats ActionNotSupported message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json actionNotSupported(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::actionNotSupported,
-                  std::to_array({arg1}));
-}
-
-void actionNotSupported(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, actionNotSupported(arg1));
-}
-
-/**
- * @internal
- * @brief Formats InvalidIndex message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json invalidIndex(int64_t arg1)
-{
-    std::string arg1Str = std::to_string(arg1);
-    return getLog(redfish::registries::base::Index::invalidIndex,
-                  std::to_array<std::string_view>({arg1Str}));
-}
-
-void invalidIndex(crow::Response& res, int64_t arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, invalidIndex(arg1));
-}
-
-/**
- * @internal
- * @brief Formats EmptyJSON message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json emptyJSON()
-{
-    return getLog(redfish::registries::base::Index::emptyJSON, {});
-}
-
-void emptyJSON(crow::Response& res)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, emptyJSON());
-}
-
-/**
- * @internal
- * @brief Formats QueryNotSupportedOnResource message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json queryNotSupportedOnResource()
-{
-    return getLog(redfish::registries::base::Index::queryNotSupportedOnResource,
-                  {});
-}
-
-void queryNotSupportedOnResource(crow::Response& res)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, queryNotSupportedOnResource());
-}
-
-/**
- * @internal
- * @brief Formats QueryNotSupportedOnOperation message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json queryNotSupportedOnOperation()
-{
-    return getLog(
-        redfish::registries::base::Index::queryNotSupportedOnOperation, {});
-}
-
-void queryNotSupportedOnOperation(crow::Response& res)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, queryNotSupportedOnOperation());
-}
-
-/**
- * @internal
- * @brief Formats QueryCombinationInvalid message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json queryCombinationInvalid()
-{
-    return getLog(redfish::registries::base::Index::queryCombinationInvalid,
-                  {});
-}
-
-void queryCombinationInvalid(crow::Response& res)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, queryCombinationInvalid());
-}
-
-/**
- * @internal
- * @brief Formats EventBufferExceeded message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json eventBufferExceeded()
-{
-    return getLog(redfish::registries::base::Index::eventBufferExceeded, {});
-}
-
-void eventBufferExceeded(crow::Response& res)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, eventBufferExceeded());
-}
-
-/**
- * @internal
- * @brief Formats InsufficientPrivilege message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json insufficientPrivilege()
-{
-    return getLog(redfish::registries::base::Index::insufficientPrivilege, {});
-}
-
-void insufficientPrivilege(crow::Response& res)
-{
-    res.result(boost::beast::http::status::forbidden);
-    addMessageToErrorJson(res.jsonValue, insufficientPrivilege());
-}
-
-/**
- * @internal
- * @brief Formats PropertyValueModified message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json propertyValueModified(std::string_view arg1,
-                                     const nlohmann::json& arg2)
-{
-    std::string arg2Str =
-        arg2.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
-    return getLog(redfish::registries::base::Index::propertyValueModified,
-                  std::to_array<std::string_view>({arg1, arg2Str}));
-}
-
-void propertyValueModified(crow::Response& res, std::string_view arg1,
-                           const nlohmann::json& arg2)
-{
-    res.result(boost::beast::http::status::ok);
-    addMessageToJson(res.jsonValue, propertyValueModified(arg1, arg2), arg1);
-}
-
-/**
- * @internal
- * @brief Formats AccountNotModified message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json accountNotModified()
-{
-    return getLog(redfish::registries::base::Index::accountNotModified, {});
-}
-
-void accountNotModified(crow::Response& res)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, accountNotModified());
-}
-
-/**
- * @internal
- * @brief Formats QueryParameterValueFormatError message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json queryParameterValueFormatError(const nlohmann::json& arg1,
-                                              std::string_view arg2)
-{
-    std::string arg1Str =
-        arg1.dump(-1, ' ', true, nlohmann::json::error_handler_t::replace);
-    return getLog(
-        redfish::registries::base::Index::queryParameterValueFormatError,
-        std::to_array<std::string_view>({arg1Str, arg2}));
-}
-
-void queryParameterValueFormatError(
-    crow::Response& res, const nlohmann::json& arg1, std::string_view arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue,
-                          queryParameterValueFormatError(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats PropertyMissing message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json propertyMissing(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::propertyMissing,
-                  std::to_array({arg1}));
-}
-
-void propertyMissing(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToJson(res.jsonValue, propertyMissing(arg1), arg1);
-}
-
-/**
- * @internal
- * @brief Formats ResourceExhaustion message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json resourceExhaustion(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::resourceExhaustion,
-                  std::to_array({arg1}));
-}
-
-void resourceExhaustion(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::service_unavailable);
-    addMessageToErrorJson(res.jsonValue, resourceExhaustion(arg1));
-}
-
-/**
- * @internal
- * @brief Formats AccountModified message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json accountModified()
-{
-    return getLog(redfish::registries::base::Index::accountModified, {});
-}
-
-void accountModified(crow::Response& res)
-{
-    res.result(boost::beast::http::status::ok);
-    addMessageToErrorJson(res.jsonValue, accountModified());
-}
-
-/**
- * @internal
- * @brief Formats QueryParameterOutOfRange message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json queryParameterOutOfRange(
-    std::string_view arg1, std::string_view arg2, std::string_view arg3)
-{
-    return getLog(redfish::registries::base::Index::queryParameterOutOfRange,
-                  std::to_array({arg1, arg2, arg3}));
-}
-
-void queryParameterOutOfRange(crow::Response& res, std::string_view arg1,
-                              std::string_view arg2, std::string_view arg3)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue,
-                          queryParameterOutOfRange(arg1, arg2, arg3));
-}
-
-/**
- * @internal
- * @brief Formats PasswordChangeRequired message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json passwordChangeRequired(const boost::urls::url_view_base& arg1)
-{
-    return getLog(redfish::registries::base::Index::passwordChangeRequired,
-                  std::to_array<std::string_view>({arg1.buffer()}));
-}
-
-void passwordChangeRequired(crow::Response& res,
-                            const boost::urls::url_view_base& arg1)
-{
-    addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1));
-}
-
-/**
- * @internal
- * @brief Formats InsufficientStorage message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json insufficientStorage()
-{
-    return getLog(redfish::registries::base::Index::insufficientStorage, {});
-}
-
-void insufficientStorage(crow::Response& res)
-{
-    res.result(boost::beast::http::status::insufficient_storage);
-    addMessageToErrorJson(res.jsonValue, insufficientStorage());
-}
-
-/**
- * @internal
  * @brief Formats OperationNotAllowed message into JSON
  *
  * See header file for more information
@@ -1849,322 +2089,6 @@
 
 /**
  * @internal
- * @brief Formats ArraySizeTooLong message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json arraySizeTooLong(std::string_view arg1, uint64_t arg2)
-{
-    std::string arg2Str = std::to_string(arg2);
-    return getLog(redfish::registries::base::Index::arraySizeTooLong,
-                  std::to_array<std::string_view>({arg1, arg2Str}));
-}
-
-void arraySizeTooLong(crow::Response& res, std::string_view arg1, uint64_t arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, arraySizeTooLong(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats GenerateSecretKeyRequired message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json generateSecretKeyRequired(const boost::urls::url_view_base& arg1)
-{
-    return getLog(redfish::registries::base::Index::generateSecretKeyRequired,
-                  std::to_array<std::string_view>({arg1.buffer()}));
-}
-
-void generateSecretKeyRequired(crow::Response& res,
-                               const boost::urls::url_view_base& arg1)
-{
-    res.result(boost::beast::http::status::forbidden);
-    addMessageToErrorJson(res.jsonValue, generateSecretKeyRequired(arg1));
-}
-
-/**
- * @internal
- * @brief Formats PropertyNotUpdated message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json propertyNotUpdated(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::propertyNotUpdated,
-                  std::to_array({arg1}));
-}
-
-void propertyNotUpdated(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, propertyNotUpdated(arg1));
-}
-
-/**
- * @internal
- * @brief Formats InvalidJSON message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json invalidJSON(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::invalidJSON,
-                  std::to_array({arg1}));
-}
-
-void invalidJSON(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, invalidJSON(arg1));
-}
-
-/**
- * @internal
- * @brief Formats ActionParameterValueOutOfRange message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json actionParameterValueOutOfRange(
-    std::string_view arg1, std::string_view arg2, std::string_view arg3)
-{
-    return getLog(
-        redfish::registries::base::Index::actionParameterValueOutOfRange,
-        std::to_array({arg1, arg2, arg3}));
-}
-
-void actionParameterValueOutOfRange(crow::Response& res, std::string_view arg1,
-                                    std::string_view arg2,
-                                    std::string_view arg3)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue,
-                          actionParameterValueOutOfRange(arg1, arg2, arg3));
-}
-
-/**
- * @internal
- * @brief Formats ArraySizeTooShort message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json arraySizeTooShort(std::string_view arg1, std::string_view arg2)
-{
-    return getLog(redfish::registries::base::Index::arraySizeTooShort,
-                  std::to_array({arg1, arg2}));
-}
-
-void arraySizeTooShort(crow::Response& res, std::string_view arg1,
-                       std::string_view arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, arraySizeTooShort(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats QueryParameterValueError message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json queryParameterValueError(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::queryParameterValueError,
-                  std::to_array({arg1}));
-}
-
-void queryParameterValueError(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, queryParameterValueError(arg1));
-}
-
-/**
- * @internal
- * @brief Formats QueryParameterUnsupported message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json queryParameterUnsupported(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::queryParameterUnsupported,
-                  std::to_array({arg1}));
-}
-
-void queryParameterUnsupported(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, queryParameterUnsupported(arg1));
-}
-
-/**
- * @internal
- * @brief Formats PayloadTooLarge message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json payloadTooLarge()
-{
-    return getLog(redfish::registries::base::Index::payloadTooLarge, {});
-}
-
-void payloadTooLarge(crow::Response& res)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, payloadTooLarge());
-}
-
-/**
- * @internal
- * @brief Formats MissingOrMalformedPart message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json missingOrMalformedPart()
-{
-    return getLog(redfish::registries::base::Index::missingOrMalformedPart, {});
-}
-
-void missingOrMalformedPart(crow::Response& res)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, missingOrMalformedPart());
-}
-
-/**
- * @internal
- * @brief Formats InvalidURI message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json invalidURI(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::invalidURI,
-                  std::to_array({arg1}));
-}
-
-void invalidURI(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, invalidURI(arg1));
-}
-
-/**
- * @internal
- * @brief Formats StringValueTooShort message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json stringValueTooShort(std::string_view arg1, std::string_view arg2)
-{
-    return getLog(redfish::registries::base::Index::stringValueTooShort,
-                  std::to_array({arg1, arg2}));
-}
-
-void stringValueTooShort(crow::Response& res, std::string_view arg1,
-                         std::string_view arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, stringValueTooShort(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats ResetRecommended message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json resetRecommended(std::string_view arg1, std::string_view arg2)
-{
-    return getLog(redfish::registries::base::Index::resetRecommended,
-                  std::to_array({arg1, arg2}));
-}
-
-void resetRecommended(crow::Response& res, std::string_view arg1,
-                      std::string_view arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, resetRecommended(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats ActionParameterValueConflict message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json
-    actionParameterValueConflict(std::string_view arg1, std::string_view arg2)
-{
-    return getLog(
-        redfish::registries::base::Index::actionParameterValueConflict,
-        std::to_array({arg1, arg2}));
-}
-
-void actionParameterValueConflict(crow::Response& res, std::string_view arg1,
-                                  std::string_view arg2)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue,
-                          actionParameterValueConflict(arg1, arg2));
-}
-
-/**
- * @internal
- * @brief Formats HeaderMissing message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json headerMissing(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::headerMissing,
-                  std::to_array({arg1}));
-}
-
-void headerMissing(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, headerMissing(arg1));
-}
-
-/**
- * @internal
- * @brief Formats HeaderInvalid message into JSON
- *
- * See header file for more information
- * @endinternal
- */
-nlohmann::json headerInvalid(std::string_view arg1)
-{
-    return getLog(redfish::registries::base::Index::headerInvalid,
-                  std::to_array({arg1}));
-}
-
-void headerInvalid(crow::Response& res, std::string_view arg1)
-{
-    res.result(boost::beast::http::status::bad_request);
-    addMessageToErrorJson(res.jsonValue, headerInvalid(arg1));
-}
-
-/**
- * @internal
  * @brief Formats UndeterminedFault message into JSON
  *
  * See header file for more information
@@ -2241,6 +2165,25 @@
 
 /**
  * @internal
+ * @brief Formats StrictAccountTypes message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json strictAccountTypes(std::string_view arg1)
+{
+    return getLog(redfish::registries::base::Index::strictAccountTypes,
+                  std::to_array({arg1}));
+}
+
+void strictAccountTypes(crow::Response& res, std::string_view arg1)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, strictAccountTypes(arg1));
+}
+
+/**
+ * @internal
  * @brief Formats PropertyDeprecated message into JSON
  *
  * See header file for more information
@@ -2359,6 +2302,43 @@
 
 /**
  * @internal
+ * @brief Formats ServiceDisabled message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json serviceDisabled(std::string_view arg1)
+{
+    return getLog(redfish::registries::base::Index::serviceDisabled,
+                  std::to_array({arg1}));
+}
+
+void serviceDisabled(crow::Response& res, std::string_view arg1)
+{
+    res.result(boost::beast::http::status::service_unavailable);
+    addMessageToErrorJson(res.jsonValue, serviceDisabled(arg1));
+}
+
+/**
+ * @internal
+ * @brief Formats EventBufferExceeded message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json eventBufferExceeded()
+{
+    return getLog(redfish::registries::base::Index::eventBufferExceeded, {});
+}
+
+void eventBufferExceeded(crow::Response& res)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, eventBufferExceeded());
+}
+
+/**
+ * @internal
  * @brief Formats AuthenticationTokenRequired message into JSON
  *
  * See header file for more information
@@ -2432,5 +2412,25 @@
     addMessageToErrorJson(res.jsonValue, propertyModified());
 }
 
+/**
+ * @internal
+ * @brief Formats GenerateSecretKeyRequired message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json generateSecretKeyRequired(const boost::urls::url_view_base& arg1)
+{
+    return getLog(redfish::registries::base::Index::generateSecretKeyRequired,
+                  std::to_array<std::string_view>({arg1.buffer()}));
+}
+
+void generateSecretKeyRequired(crow::Response& res,
+                               const boost::urls::url_view_base& arg1)
+{
+    res.result(boost::beast::http::status::forbidden);
+    addMessageToErrorJson(res.jsonValue, generateSecretKeyRequired(arg1));
+}
+
 } // namespace messages
 } // namespace redfish
diff --git a/scripts/parse_registries.py b/scripts/parse_registries.py
index 573f8a7..a7eb5bf 100755
--- a/scripts/parse_registries.py
+++ b/scripts/parse_registries.py
@@ -236,103 +236,6 @@
     return "bad_request"
 
 
-def get_old_index(entry):
-    old_order = [
-        "ResourceInUse",
-        "MalformedJSON",
-        "ResourceMissingAtURI",
-        "ActionParameterValueFormatError",
-        "ActionParameterValueNotInList",
-        "InternalError",
-        "UnrecognizedRequestBody",
-        "ResourceAtUriUnauthorized",
-        "ActionParameterUnknown",
-        "ResourceCannotBeDeleted",
-        "PropertyDuplicate",
-        "ServiceTemporarilyUnavailable",
-        "ResourceAlreadyExists",
-        "AccountForSessionNoLongerExists",
-        "CreateFailedMissingReqProperties",
-        "PropertyValueFormatError",
-        "PropertyValueNotInList",
-        "PropertyValueOutOfRange",
-        "ResourceAtUriInUnknownFormat",
-        "ServiceDisabled",
-        "ServiceInUnknownState",
-        "EventSubscriptionLimitExceeded",
-        "ActionParameterMissing",
-        "StringValueTooLong",
-        "SessionTerminated",
-        "SubscriptionTerminated",
-        "ResourceTypeIncompatible",
-        "ResetRequired",
-        "ChassisPowerStateOnRequired",
-        "ChassisPowerStateOffRequired",
-        "PropertyValueConflict",
-        "PropertyValueResourceConflict",
-        "PropertyValueExternalConflict",
-        "PropertyValueIncorrect",
-        "ResourceCreationConflict",
-        "MaximumErrorsExceeded",
-        "PreconditionFailed",
-        "PreconditionRequired",
-        "OperationFailed",
-        "OperationTimeout",
-        "PropertyValueTypeError",
-        "PropertyValueError",
-        "ResourceNotFound",
-        "CouldNotEstablishConnection",
-        "PropertyNotWritable",
-        "QueryParameterValueTypeError",
-        "ServiceShuttingDown",
-        "ActionParameterDuplicate",
-        "ActionParameterNotSupported",
-        "SourceDoesNotSupportProtocol",
-        "StrictAccountTypes",
-        "AccountRemoved",
-        "AccessDenied",
-        "QueryNotSupported",
-        "CreateLimitReachedForResource",
-        "GeneralError",
-        "Success",
-        "Created",
-        "NoOperation",
-        "PropertyUnknown",
-        "NoValidSession",
-        "InvalidObject",
-        "ResourceInStandby",
-        "ActionParameterValueTypeError",
-        "ActionParameterValueError",
-        "SessionLimitExceeded",
-        "ActionNotSupported",
-        "InvalidIndex",
-        "EmptyJSON",
-        "QueryNotSupportedOnResource",
-        "QueryNotSupportedOnOperation",
-        "QueryCombinationInvalid",
-        "EventBufferExceeded",
-        "InsufficientPrivilege",
-        "PropertyValueModified",
-        "AccountNotModified",
-        "QueryParameterValueFormatError",
-        "PropertyMissing",
-        "ResourceExhaustion",
-        "AccountModified",
-        "QueryParameterOutOfRange",
-        "PasswordChangeRequired",
-        "InsufficientStorage",
-        "OperationNotAllowed",
-        "ArraySizeTooLong",
-        "Invalid File",
-        "GenerateSecretKeyRequired",
-    ]
-
-    if entry[0] in old_order:
-        return old_order.index(entry[0])
-    else:
-        return 999999
-
-
 def make_error_function(entry_id, entry, is_header):
 
     arg_as_url = {
@@ -501,12 +404,11 @@
 def create_error_registry(entry):
     file, json_dict, namespace, url = entry
 
-    messages = OrderedDict(
-        sorted(json_dict["Messages"].items(), key=get_old_index)
-    )
     error_messages_hpp = os.path.join(
         SCRIPT_DIR, "..", "redfish-core", "include", "error_messages.hpp"
     )
+    messages = json_dict["Messages"]
+
     with open(
         error_messages_hpp,
         "w",
@@ -525,7 +427,6 @@
 #include <source_location>
 #include <string>
 #include <string_view>
-#include <utility>
 
 // IWYU pragma: no_forward_declare crow::Response
 
