Skip to content

Errors

Two envelope shapes are in play:

  • Most endpoints return the application result ServiceResult{ IsSuccess, Message, ErrorCode, ValidationErrors, Metadata } — so the machine-readable code is in ErrorCode and the human string in Message (e.g. the role codes below).
  • OAuth / OIDC endpoints follow the RFC shape — { error, error_description }.

ExceptionHandlingMiddleware maps exceptions to status codes: ValidationException / DomainValidationException → 400, DomainEntityNotFoundException → 404, OAuthSessionExpiredException → 401, UnauthorizedAccessException → 403, otherwise 500.

StatusMeaning
400Validation / malformed request
401Unauthenticated (missing/invalid token)
403Authenticated but not permitted (e.g. not a member; ORG_SEAL_REQUIRED; tenant conflict)
404Not found (or feature disabled)
409Conflict (duplicate name/key, cycle)
500Unhandled server error

A representative set (RoleConstants.ErrorCodes):

CodeMeaning
ROLE_NOT_FOUNDRole does not exist
ROLE_DUPLICATE_NAME / ROLE_DUPLICATE_KEYName/key already used
ROLE_SYSTEM_PROTECTEDSystem roles can’t be modified/deleted
ROLE_KEY_RESERVEDReserved role key
ROLE_CIRCULAR_REFERENCE / ROLE_HIERARCHY_DEPTH_EXCEEDEDHierarchy violations
ROLE_IN_USE / ROLE_LAST_ADMINCan’t delete a role in use / the last admin role
ROLE_INSUFFICIENT_PERMISSIONCaller lacks permission
ROLE_MUTUAL_EXCLUSIONConflicts with an assigned role (SoD)