diff --git a/common/instance_id.hpp b/common/instance_id.hpp
index 2a29f82..40de1f1 100644
--- a/common/instance_id.hpp
+++ b/common/instance_id.hpp
@@ -5,70 +5,12 @@
 #include <cerrno>
 #include <cstdint>
 #include <exception>
-#include <expected>
 #include <string>
 #include <system_error>
 
 namespace pldm
 {
 
-/**
- * @class InstanceIdError
- * @brief Exception for PLDM instance ID allocation and management errors.
- */
-class InstanceIdError : public std::exception
-{
-  public:
-    InstanceIdError(const InstanceIdError&) noexcept = default;
-    InstanceIdError(InstanceIdError&&) noexcept = default;
-    InstanceIdError& operator=(const InstanceIdError&) noexcept = default;
-    InstanceIdError& operator=(InstanceIdError&&) noexcept = default;
-    ~InstanceIdError() noexcept override = default;
-
-    /** @brief Construct with an error code. */
-    explicit InstanceIdError(int rc) : rc_(rc), msg_(rcToMsg(rc)) {}
-
-    /** @brief Construct with an error code and a string message (copied). */
-    InstanceIdError(int rc, const std::string& m) : rc_(rc), msg_(m) {}
-
-    /** @brief Construct with an error code and a string message (moved). */
-    InstanceIdError(int rc, std::string&& m) : rc_(rc), msg_(std::move(m)) {}
-
-    /** @brief Get the error code. */
-    int rc() const noexcept
-    {
-        return rc_;
-    }
-
-    /** @brief Get the error message. */
-    const std::string& msg() const noexcept
-    {
-        return msg_;
-    }
-
-    /** @brief Convert an error code to a message. */
-    static std::string rcToMsg(int rc)
-    {
-        switch (rc)
-        {
-            case -EAGAIN:
-                return "No free instance ids";
-            default:
-                return std::system_category().message(rc);
-        }
-    }
-
-    /** @brief Get the error message (for std::exception). */
-    const char* what() const noexcept override
-    {
-        return msg_.c_str();
-    }
-
-  private:
-    int rc_;
-    std::string msg_;
-};
-
 /** @class InstanceId
  *  @brief Implementation of PLDM instance id as per DSP0240 v1.0.0
  */
@@ -111,19 +53,22 @@
 
     /** @brief Allocate an instance ID for the given terminus
      *  @param[in] tid - the terminus ID the instance ID is associated with
-     *  @return - PLDM instance id on success, or InstanceIdError on failure
+     *  @return - PLDM instance id or -EAGAIN if there are no available instance
+     *            IDs
      */
-    std::expected<uint8_t, InstanceIdError> next(uint8_t tid)
+    uint8_t next(uint8_t tid)
     {
         uint8_t id;
         int rc = pldm_instance_id_alloc(pldmInstanceIdDb, tid, &id);
 
+        if (rc == -EAGAIN)
+        {
+            throw std::runtime_error("No free instance ids");
+        }
+
         if (rc)
         {
-            return std::unexpected(
-                InstanceIdError{rc, "Failed to allocate instance ID for EID " +
-                                        std::to_string(tid) + ": " +
-                                        InstanceIdError::rcToMsg(rc)});
+            throw std::system_category().default_error_condition(rc);
         }
 
         return id;
