feat: classify local command failures and additional API statuses in the JSON error envelope - #1680
Merged
Merged
Conversation
…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
enabled auto-merge (squash)
September 18, 2026 07:23
ramya18101
approved these changes
Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔧 Changes
Previously, many local command failures returned bare
fmt.Errorf/errors.Newvalues that fell through to the genericcode: unknown/reason: unclassifiedin 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.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 asusage; malformed local JSON payloads and other client-side input validation surface asvalidation.auth0 apinow classifies its own client-side failures: an invalid method or URI, an unreadable--datafile, and empty stdin surface asusage/validation, and a403 insufficient_scoperesponse surfaces asauthwith reasoninsufficient_scope.409responses now classify as a newconflictcode, and410/415asvalidation, instead of falling back tounknown/server_error.The classification wrappers (
usageError,authError,validationError) preserve the original error viaError()/Unwrap(), soerrors.Is/errors.Asstill traverse and the message a human sees is unchanged. Only the envelopecode/reasonand analytics classification change.🔬 Testing
make test-unitpasses, including new table rows inexit_test.gofor the409/410/415class and reason mappings.make lintreports no new issues from these changes.make docsproduces no diff (the change is classification metadata, not command/flag surface).📝 Checklist