error_code never changes wording, you can build dashboards and alerts on it with confidence.
The codes
How to read them at a glance
Group them by who needs to act:- 401s — the token is the problem. Usually the agent isn’t sending one, or it expired. If every authenticated call fails the same way, suspect your issuer or audience configuration instead. With the SDK in use, expiry should be auto-refreshed, so a steady stream of
EXPIRED_TOKENis worth investigating (clock skew, a non-SDK caller). - 403
MISSING_SCOPE— authentic but not authorized. The agent is who it says it is; it just wasn’t granted that scope. This is an access decision, not a bug — don’t “fix” it by widening scopes reflexively. WRONG_AUDIENCE/WRONG_ISSUER— almost always your config. Setexpected_audienceto your platform’s canonical resource URI andMUDRAID_EXPECTED_ISSUERSto your environment’s authorization-server issuer. See middleware configuration.- 500s — your side, not the agent’s.
JWKS_UNAVAILABLEis a connectivity problem reaching MudraID;MIDDLEWARE_NOT_READYis a broken YAML. Neither means the agent did anything wrong.
ENFORCE_*) codes, see Error responses.
What to alert on
- A spike in
JWKS_UNAVAILABLE→ connectivity to MudraID is degraded. - Any
MIDDLEWARE_NOT_READY→ you shipped a bad scopes file; page yourself. - A spike in
MISSING_SCOPEfrom one agent → it’s trying to do something it wasn’t granted; could be a misconfigured integration or a probe.

