[mason] Clearer, actionable auth error messages - #522
Open
akansal2 wants to merge 3 commits into
Open
Conversation
Surface the SDK's auth error verbatim (as before) and replace the misleading fixed hint (`databricks auth login ...`) with a single, always-valid next step: `mason login`. Instead of matching on the SDK's error text (brittle across SDK versions), mirror wrap_api_error — pass the upstream message through and add one supplemental hint — plus a structural DATABRICKS_TOKEN env check to flag the one override the SDK message doesn't make obvious. The scaffolded agent templates' startup auth check gets the same one-command guidance. Co-authored-by: Isaac <no-reply@databricks.com>
Author
|
Pairs with #523, which makes |
The startup auth message named the multi-process detail ('make sure the agent
process sees it') and the Apps substrate ('for a deployed app') — both
implementation details Mason hides. Reduce it to the action: log in with
mason login, then set DATABRICKS_CONFIG_PROFILE (or HOST/TOKEN). Drops the
now-unused os import.
Co-authored-by: Isaac <no-reply@databricks.com>
akansal2
marked this pull request as ready for review
September 3, 2026 16:56
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.
What did you change, and why?
Change: Fix Mason's confusing auth errors. The CLI wrapped every
WorkspaceClientfailure with a fixed hint —Check your profile (databricks auth login --profile <name>) or pass --profile— that often didn't match the real failure and pointed at the wrong command.Why: From the custom-agent bug bash: "Auth error confusing", "Error message inconsistencies" (same command → two different messages; user had to unset a stray token), and Ann's
mason mcp listwhere the fix wasmason login, notdatabricks auth login.Approach (deliberately not string-matching the SDK error, which is brittle across SDK versions):
… use --profile,Env: DATABRICKS_TOKEN).mason login— mirroring the existingwrap_api_errorpattern (pass the upstream message through, add a supplemental hint).DATABRICKS_TOKENset?) — the one override the SDK message doesn't make obvious, and the root cause of the "unset my token" report._check_databricks_auth, langgraph + openai) gets the same single-command guidance.Pairs with a follow-up PR that makes
mason loginauthenticate on its own (so no separatedatabricks auth loginis ever needed).How do you know it works?
Testing:
python -m py_compileon all changed modules (clean). Added unit tests inerrors_test.pycoveringauth_hintfor the default, explicit-profile, and stray-DATABRICKS_TOKENcases. Full unit suite runs in CI. Draft until CI is green.