@rubric-app/core ships a small hierarchy of typed error classes. All inherit from GovernanceError, which inherits from the standard Error.
GovernanceError
Base class for every Rubric-thrown error. Catch this to handle any SDK failure generically:
GovernanceProblemError
Thrown when Rubric returns an RFC 9457 problem-details response. Carries the parsed body so you can branch on problem.type instead of parsing error strings.
| Field | Type | Notes |
|---|---|---|
problem.type | string | URI identifying the problem class. |
problem.title | string | Short human-readable summary. |
problem.status | number | HTTP status code. |
problem.detail | string | null | Longer description, if any. Always passes through scrubSecrets before being interpolated into err.message. |
problem.instance | string | null | URI of the specific occurrence, if any. |
IdentityRevokedError
Thrown when the server says the agent’s identity is no longer valid. After this throws, the TokenStore enters a terminal dead state — subsequent calls to tokenStore.token() will also throw.
Recovery: re-enroll the agent (mint a fresh enrollment token, restart the process). The agentName is idempotent, so you’ll get the same agent id back.
IdentityNotInitializedError
Thrown when something tries to use a TokenStore that hasn’t been bootstrapped yet. You shouldn’t see this in normal use — bootstrapTokenStore does the initial enrollment for you.
Helpers
@rubric-app/core also exports two utilities for working with unknown thrown values without unsafe casts:
_internal.ts umbrella — stable in practice but not covered by the public semver contract.