Skip to content

feat: classify local command failures and additional API statuses in the JSON error envelope - #1680

Merged
developerkunal merged 1 commit into
mainfrom
feat/error-classification-sweep
Sep 18, 2026
Merged

developerkunal merged 1 commit into
mainfrom
feat/error-classification-sweep

Conversation

@developerkunal

Copy link
Copy Markdown
Contributor

🔧 Changes

Previously, many local command failures returned bare fmt.Errorf/errors.New values that fell through to the generic code: unknown / reason: unclassified in the JSON error envelope. This makes the envelope actionable for agents by classifying local, user-fixable failures with a specific code and reason, without touching the human-facing message text.

  • Wrapped local validation failures across auth0 client-grants, auth0 apps, auth0 quickstarts, auth0 network-acl, auth0 guardian, auth0 email, auth0 actions, auth0 roles, auth0 users, auth0 flows, auth0 forms, auth0 login, auth0 terraform generate, auth0 api, and others. Missing required flags, incompatible flag combinations, and invalid flag values now surface as usage; malformed local JSON payloads and other client-side input validation surface as validation.
  • auth0 api now classifies its own client-side failures: an invalid method or URI, an unreadable --data file, and empty stdin surface as usage/validation, and a 403 insufficient_scope response surfaces as auth with reason insufficient_scope.
  • Widened server-side HTTP status classification: 409 responses now classify as a new conflict code, and 410/415 as validation, instead of falling back to unknown/server_error.

The classification wrappers (usageError, authError, validationError) preserve the original error via Error()/Unwrap(), so errors.Is/errors.As still traverse and the message a human sees is unchanged. Only the envelope code/reason and analytics classification change.

🔬 Testing

  • make test-unit passes, including new table rows in exit_test.go for the 409/410/415 class and reason mappings.
  • make lint reports no new issues from these changes.
  • make docs produces no diff (the change is classification metadata, not command/flag surface).

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

…the JSON error envelope

Wrap local, user-fixable command validation failures (missing required
flags, incompatible flag combinations, invalid flag values, malformed
local JSON payloads, missing input) so they surface with a specific code
and reason in the JSON error envelope instead of the generic
unknown/unclassified. Human-facing messages are unchanged.

Also classify 409 API responses as conflict, and 410/415 as validation,
instead of falling back to unknown/server_error.
@developerkunal
developerkunal requested a review from a team as a code owner September 18, 2026 07:21
@developerkunal
developerkunal enabled auto-merge (squash) September 18, 2026 07:23
@developerkunal
developerkunal merged commit 6e7ee5a into main Sep 18, 2026
6 checks passed
@developerkunal
developerkunal deleted the feat/error-classification-sweep branch September 18, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants