Skip to content

Latest CLI v0.264.2 Error: cache: token not found when running CLI from Terraform plan #3439

Description

@pjonkhhnk

Describe the issue

Since CLI v0.264.2 terraform plan fails when interacting with Databricks. It fails during a terraform plan command with the following error:

Error: cannot read metastores: cannot read data metastores: failed during request visitor: default auth: databricks-cli: cannot get access token: Error: cache: token not found.

This suddenly happened after upgrade from v0.262.0 which worked fine.

Steps to reproduce the behavior

  1. The error van be reproduced from both Azure DevOps pipeline or locally
  2. Init terraform using a storage account back-end configuration (init command is working fine)

RESOURCE_GROUP_NAME="rg-tfstate"
STORAGE_ACCOUNT_NAME=""
SUBSCRIPTION_ID=""
CONTAINER_NAME="tfstate"
STATE_KEY="terraform.tfstate"

execute az login to your tenant

az account set -s "$SUBSCRIPTION_ID"

Initialize Terraform

terraform init -reconfigure
-backend-config="resource_group_name=$RESOURCE_GROUP_NAME"
-backend-config="storage_account_name=$STORAGE_ACCOUNT_NAME"
-backend-config="container_name=$CONTAINER_NAME"
-backend-config="key=$STATE_KEY"

  1. Execute terraform plan command
    terraform plan -out test.tfplan

  2. See error### Expected Behavior
    Clear and concise description of what should have happened

Error: cannot read metastores: cannot read data metastores: failed during request visitor: default auth: databricks-cli: cannot get access token: Error: cache: token not found.

The error was resolved by adding this env variable:
export DATABRICKS_AUTH_TYPE=azure-cli

Actual Behavior

Clear and concise description of what actually happened

OS and CLI version

OS: Ubuntu 24.04.2 LTS
CLI v0.264.2

Is this a regression?

Did this work in a previous version of the CLI? If so, which versions did you try?
Yes works in previous version (env variable is not needed).

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingCLICLI related issues

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions