Skip to content

Replace fallback with MissingCredentials#162

Open
mendral-app[bot] wants to merge 1 commit into
mainfrom
mendral/replace-fallback-with-missing-credentials
Open

Replace fallback with MissingCredentials#162
mendral-app[bot] wants to merge 1 commit into
mainfrom
mendral/replace-fallback-with-missing-credentials

Conversation

@mendral-app

@mendral-app mendral-app Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace the raw BlaxelAuth base class fallback in auth() with a MissingCredentials sentinel that raises an actionable CredentialsError when credentials exist but no supported auth method matches (e.g. only refresh_token/access_token present)
  • Prevents confusing NotImplementedError: Subclasses must implement the token property in production

Context

Resolves insight: Unhandled auth fallback returns abstract base class

Sentry shows this error occurring with sdk-python@0.2.55 when users have a ~/.blaxel/config.yaml workspace entry with refresh_token/access_token but no device_code, api_key, or client_credentials.

Changes

  • src/blaxel/core/authentication/__init__.py: Replace line 129's BlaxelAuth(...) with MissingCredentials(...) providing a clear message
  • tests/core/test_authentication_env_vars.py: Add test covering the incomplete credentials fallback path

Note

Created by Mendral. Tag @mendral-app with feedback or questions.

When credentials exist but don't match any known auth type (e.g. only
refresh_token/access_token), the auth() function previously returned a
raw BlaxelAuth base class whose .token property raises NotImplementedError.

Replace with MissingCredentials that raises an actionable CredentialsError
guiding users to run `bl login` or set BL_API_KEY.
@mendral-app mendral-app Bot requested a review from a team June 10, 2026 19:52
@mendral-app mendral-app Bot marked this pull request as ready for review June 10, 2026 20:06
@drappier-charles

Copy link
Copy Markdown
Contributor

@Mendral are you sure? the default one could also be for unauthenticated resources? We don't have only authenticated thing

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.

1 participant