github/spec-kit · error · ValueError

providers[{i}]: unknown provider {provider!r}; registered: {

Error message

providers[{i}]: unknown provider {provider!r}; registered: {sorted(AUTH_REGISTRY.keys())}

What it means

Raised when `get_provider(provider)` returns `None` — the `provider` string does not match any key in `AUTH_REGISTRY`. The message lists all registered provider keys so you can see exactly what names are accepted.

Source

Thrown at src/specify_cli/authentication/config.py:167

        auth = entry_raw.get("auth", "")
        if not isinstance(auth, str) or not auth:
            raise ValueError(f"providers[{i}]: 'auth' must be a non-empty string")

        token = entry_raw.get("token")
        token_env = entry_raw.get("token_env")

        # Validate token/token_env types
        if token is not None and (not isinstance(token, str) or not token.strip()):
            raise ValueError(f"providers[{i}]: 'token' must be a non-empty string")
        if token_env is not None and (not isinstance(token_env, str) or not token_env.strip()):
            raise ValueError(f"providers[{i}]: 'token_env' must be a non-empty string")

        # Validate provider+scheme compatibility
        from . import get_provider as _get_provider
        _prov = _get_provider(provider)
        if _prov is None:
            from . import AUTH_REGISTRY
            raise ValueError(
                f"providers[{i}]: unknown provider {provider!r}; "
                f"registered: {sorted(AUTH_REGISTRY.keys())}"
            )
        if auth not in _prov.supported_auth_schemes:
            raise ValueError(
                f"providers[{i}]: provider {provider!r} does not support "
                f"auth scheme {auth!r}; supported: {list(_prov.supported_auth_schemes)}"
            )

        # Validate token source based on auth scheme
        if auth in ("bearer", "basic-pat"):
            if not token and not token_env:
                raise ValueError(
                    f"providers[{i}]: auth={auth!r} requires 'token' or 'token_env'"
                )
        elif auth == "azure-ad":
            tenant_id = entry_raw.get("tenant_id")
            client_id = entry_raw.get("client_id")

View on GitHub (pinned to bf88c9f9a8)

Solutions

  1. Read the `registered: [...]` list in the error and use one of those exact keys
  2. Match the case exactly — lookup is case-sensitive
  3. Upgrade spec-kit if the provider you need is a recently added one

Example fix

# before
- hosts: ["github.com"]
  provider: gh

# after
- hosts: ["github.com"]
  provider: github
Defensive patterns

Strategy: type-guard

Validate before calling

from specify_cli.authentication import AUTH_REGISTRY, get_provider

if get_provider(entry["provider"]) is None:
    raise SystemExit(
        f"unknown provider {entry['provider']!r}; "
        f"choose from {sorted(AUTH_REGISTRY)}"
    )

Type guard

from specify_cli.authentication import get_provider

def is_registered_provider(name: object) -> bool:
    return isinstance(name, str) and get_provider(name) is not None

Try / catch

try:
    load_auth_config(raw)
except ValueError as exc:
    if "unknown provider" in str(exc):
        # parse the 'registered: [...]' list from the message and re-prompt
        raise
    raise

Prevention

When it happens

Trigger: A `provider` value like `"gh"`, `"GitHub"` (case-sensitive lookup), `"azure-devops-cl"`, or any name not in `sorted(AUTH_REGISTRY.keys())`.

Common situations: Using an alias or abbreviation instead of the canonical registry key; case mismatch (`Github` vs `github`); referencing a provider added in a newer version of spec-kit than the installed one.

Related errors


AI-assisted analysis of github/spec-kit@bf88c9f9a8 (2026-08-14). Data as JSON: /api/errors/575bf0d138047554. Report an issue: GitHub.