Skip to content

SMP V1 and V2 Errors

The Simple Management Protocol (SMP) error responses.

T = TypeVar('T', bound=IntEnum) module-attribute

MGMT_ERR

Bases: IntEnum

General error codes for the Simple Management Protocol (SMP).

Source code in smp/error.py
@unique
class MGMT_ERR(IntEnum):
    """General error codes for the Simple Management Protocol (SMP)."""

    EOK = 0
    """No error (success)."""

    EUNKNOWN = 1
    """Unknown error."""

    ENOMEM = 2
    """Insufficient memory (likely not enough space for CBOR object)."""

    EINVAL = 3
    """Error in input value."""

    ETIMEOUT = 4
    """Operation timed out."""

    ENOENT = 5
    """No such file/entry."""

    EBADSTATE = 6
    """Current state disallows command."""

    EMSGSIZE = 7
    """Response too large."""

    ENOTSUP = 8
    """Command not supported."""

    ECORRUPT = 9
    """Corrupt."""

    EBUSY = 10
    """Command blocked by processing of other command."""

    EACCESSDENIED = 11
    """Access to specific function, command or resource denied."""

    UNSUPPORTED_TOO_OLD = 12
    """Requested SMP MCUmgr protocol version is not supported (too old)."""

    UNSUPPORTED_TOO_NEW = 13
    """Requested SMP MCUmgr protocol version is not supported (too new)."""

    EPERUSER = 256
    """User errors defined from 256 onwards"""

EOK = 0 class-attribute instance-attribute

No error (success).

EUNKNOWN = 1 class-attribute instance-attribute

Unknown error.

ENOMEM = 2 class-attribute instance-attribute

Insufficient memory (likely not enough space for CBOR object).

EINVAL = 3 class-attribute instance-attribute

Error in input value.

ETIMEOUT = 4 class-attribute instance-attribute

Operation timed out.

ENOENT = 5 class-attribute instance-attribute

No such file/entry.

EBADSTATE = 6 class-attribute instance-attribute

Current state disallows command.

EMSGSIZE = 7 class-attribute instance-attribute

Response too large.

ENOTSUP = 8 class-attribute instance-attribute

Command not supported.

ECORRUPT = 9 class-attribute instance-attribute

Corrupt.

EBUSY = 10 class-attribute instance-attribute

Command blocked by processing of other command.

EACCESSDENIED = 11 class-attribute instance-attribute

Access to specific function, command or resource denied.

UNSUPPORTED_TOO_OLD = 12 class-attribute instance-attribute

Requested SMP MCUmgr protocol version is not supported (too old).

UNSUPPORTED_TOO_NEW = 13 class-attribute instance-attribute

Requested SMP MCUmgr protocol version is not supported (too new).

EPERUSER = 256 class-attribute instance-attribute

User errors defined from 256 onwards

ErrorV1

Bases: Response

SMP error response version 1.

Source code in smp/error.py
class ErrorV1(message.Response):
    """SMP error response version 1."""

    RESPONSE_TYPE = message.ResponseType.ERROR_V1

    rc: MGMT_ERR
    """Error code."""

    rsn: str | None = None
    """Error reason."""

RESPONSE_TYPE = message.ResponseType.ERROR_V1 class-attribute instance-attribute

rc: MGMT_ERR instance-attribute

Error code.

rsn: str | None = None class-attribute instance-attribute

Error reason.

Err

Bases: BaseModel, Generic[T]

SMP error response version 2 err map.

Source code in smp/error.py
class Err(BaseModel, Generic[T]):
    """SMP error response version 2 `err` map."""

    model_config = ConfigDict(extra="forbid", frozen=True, arbitrary_types_allowed=True)

    group: GroupIdField
    rc: T

model_config = ConfigDict(extra='forbid', frozen=True, arbitrary_types_allowed=True) class-attribute instance-attribute

group: GroupIdField instance-attribute

rc: T instance-attribute

ErrorV2

Bases: Response, Generic[T]

SMP error response version 2.

Source code in smp/error.py
class ErrorV2(message.Response, Generic[T]):
    """SMP error response version 2."""

    RESPONSE_TYPE = message.ResponseType.ERROR_V2

    err: Err[T]

RESPONSE_TYPE = message.ResponseType.ERROR_V2 class-attribute instance-attribute

err: Err[T] instance-attribute