Skip to content

Commit 2a10e0c

Browse files
smurchingclaude
andcommitted
Improve OBO error message to guide users on proper WorkspaceClient instantiation
The error message now: - Explains the most common cause: instantiating WorkspaceClient at model-loading time - Provides clear guidance to instantiate within predict() or predict_stream() - Maintains existing checks for UserAuthPolicy and workspace OBO enablement - Links to documentation for additional help 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 88f1047 commit 2a10e0c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

databricks/sdk/credentials_provider.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,13 @@ def __call__(self, cfg: "Config") -> CredentialsProvider:
11381138
header_factory = model_serving_auth_visitor(cfg, self.credential_type)
11391139
if not header_factory:
11401140
raise ValueError(
1141-
f"Unable to authenticate using {self.credential_type} in Databricks Model Serving Environment"
1141+
"Unable to authenticate using model_serving_user_credentials in Databricks Model Serving Environment. "
1142+
"This error typically occurs when the WorkspaceClient is instantiated at model-loading time rather than within a predict() or predict_stream() call. "
1143+
"Please ensure you instantiate the WorkspaceClient inside your predict() or predict_stream() function. "
1144+
"Additionally, verify that you have specified UserAuthPolicy when logging the agent model and that "
1145+
"On Behalf of User Authorization for Agents is enabled in your workspace. "
1146+
"Refer to the documentation for more information: https://docs.databricks.com/aws/en/generative-ai/agent-framework/authenticate-on-behalf-of-user. "
1147+
"If the issue persists, contact Databricks Support."
11421148
)
11431149
return header_factory
11441150
else:

0 commit comments

Comments
 (0)