cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with ValueError: unknown: unknown when using Databricks SDK for Python (AccountClient)

Seunghyun
Contributor

Hello, I am currently developing a Python script using the Databricks SDK to manage Service Principal secrets within a Databricks Notebook environment.

I am using M2M (Machine-to-Machine) authentication, and the Service Principal in use has been granted the Account Admin role.

```

from databricks.sdk import AccountClient

 

a = AccountClient(

host="https://accounts.cloud.databricks.com",

account_id="{MY_ACCOUNT_ID}",

client_id="{MY_CLIENT_ID}",

client_secret="{MY_CLINET_SECRET}"

)

 

sp_list = a.service_principals.list()

for sp in sp_list:

print(sp) # for test

```

Here is the code snippet I am using:



When I execute this code, I encounter the following error: ValueError: unknown: unknown

Are there any similar known cases or any guidance on how to resolve this issue?

1 REPLY 1

Ashwin_DSA
Databricks Employee
Databricks Employee

Hi @Seunghyun,

This error is likely caused by the Databricks SDK’s authentication step, not by the Service Principals API itself. The SDK is trying to obtain an OAuth token for your AccountClient, the token request is failing, and the error payload coming back from the server doesn’t include the usual error/error_description fields, and so the SDK can only surface it as ValueError: unknown: unknown.

From what I can see, common causes are:

  • Using the wrong accounts host URL for your cloud/region (for example, https://accounts.cloud.databricks.com is specific to certain deployments).
  • A misconfigured client (service principal)... e.g., not truly account-level, not enabled for M2M, or not allowed on that account.
  • General OAuth misconfiguration between the host, account_id, client_id, and client_secret.

Can you check whether...

  1. The host value matches your Databricks account console for your cloud/region.
  2. The client_id / client_secret belong to an account-level application that’s configured for client‑credentials on that same account.

If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.

Regards,
Ashwin | Delivery Solution Architect @ Databricks
Helping you build and scale the Data Intelligence Platform.
***Opinions are my own***