Skip to content

Improve auth token error formatting for easier copy-paste#4602

Open
jamesbroadhead wants to merge 1 commit intodatabricks:mainfrom
jamesbroadhead:fix-auth-login-error-formatting
Open

Improve auth token error formatting for easier copy-paste#4602
jamesbroadhead wants to merge 1 commit intodatabricks:mainfrom
jamesbroadhead:fix-auth-login-error-formatting

Conversation

@jamesbroadhead
Copy link

Changes

Format the auth token error message across multiple lines so the
suggested databricks auth login command is on its own line and easy
to copy-paste.

Before:

Error: cache: databricks OAuth is not configured for this host. Try logging in again with `databricks auth login --host https://example.com` before retrying. If this fails, please report this issue to the Databricks CLI maintainers at https://github.com/databricks/cli/issues/new

After:

Error: cache: databricks OAuth is not configured for this host.

To reauthenticate, run the following command:

  $ databricks auth login --host https://example.com

If this fails, please report this issue to the Databricks CLI maintainers at https://github.com/databricks/cli/issues/new

Why

When auth fails, the suggested login command was printed on the same line as the error and config details, making it difficult to select and copy. This follows the same multi-line pattern already used by RewriteAuthError for invalid refresh token errors.

Tests

  • Unit tests updated and passing (go test ./cmd/auth/ -run TestToken_loadToken)
  • Acceptance test golden file updated and passing (go test ./acceptance/... -run TestAccept/cmd/auth/token)

When auth fails, the suggested `databricks auth login` command was
printed on the same line as the error and config details, making it
hard to copy. Split the message across multiple lines so the command
is visually distinct and easy to select.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 4602
  • Commit SHA: 152a1b775d73b42086daf3d4b2f361c84d906f16

Checks will be approved automatically on success.


### CLI
* Add `completion install`, `uninstall`, and `status` subcommands ([#4581](https://github.com/databricks/cli/pull/4581))
* Improve `auth token` error formatting for easier copy-paste of login commands
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include a link to the PR here

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