{"record":{"id":"1580f1783a5530df","repo":"github/spec-kit","slug":"providers-i-token-env-must-be-a-non-empty-st","errorCode":null,"errorMessage":"providers[{i}]: 'token_env' must be a non-empty string","messagePattern":"providers\\[(.+?)\\]: 'token_env' must be a non-empty string","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/specify_cli/authentication/config.py","lineNumber":160,"sourceCode":"                    \"(e.g. 'github.com' or '*.visualstudio.com').\"\n                )\n\n        provider = entry_raw.get(\"provider\", \"\")\n        if not isinstance(provider, str) or not provider:\n            raise ValueError(f\"providers[{i}]: 'provider' must be a non-empty string\")\n\n        auth = entry_raw.get(\"auth\", \"\")\n        if not isinstance(auth, str) or not auth:\n            raise ValueError(f\"providers[{i}]: 'auth' must be a non-empty string\")\n\n        token = entry_raw.get(\"token\")\n        token_env = entry_raw.get(\"token_env\")\n\n        # Validate token/token_env types\n        if token is not None and (not isinstance(token, str) or not token.strip()):\n            raise ValueError(f\"providers[{i}]: 'token' must be a non-empty string\")\n        if token_env is not None and (not isinstance(token_env, str) or not token_env.strip()):\n            raise ValueError(f\"providers[{i}]: 'token_env' must be a non-empty string\")\n\n        # Validate provider+scheme compatibility\n        from . import get_provider as _get_provider\n        _prov = _get_provider(provider)\n        if _prov is None:\n            from . import AUTH_REGISTRY\n            raise ValueError(\n                f\"providers[{i}]: unknown provider {provider!r}; \"\n                f\"registered: {sorted(AUTH_REGISTRY.keys())}\"\n            )\n        if auth not in _prov.supported_auth_schemes:\n            raise ValueError(\n                f\"providers[{i}]: provider {provider!r} does not support \"\n                f\"auth scheme {auth!r}; supported: {list(_prov.supported_auth_schemes)}\"\n            )\n\n        # Validate token source based on auth scheme\n        if auth in (\"bearer\", \"basic-pat\"):","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/src/specify_cli/authentication/config.py#L142-L178","documentation":"Raised when `token_env` is present but is not a string or is whitespace-only. `token_env` names the environment variable holding the token (it is normalized via `_norm` later); it must be a bare environment-variable name as a non-empty string.","triggerScenarios":"`\"token_env\": \"\"`, `\"token_env\": \"   \"`, or a non-string value like `\"token_env\": true` / `\"token_env\": [\"GITHUB_TOKEN\"]`.","commonSituations":"Wrapping the env var name in a list or map because a template expected multiple values; an unset template placeholder leaving an empty string; copy-paste from a docker-compose-style `${VAR}` syntax instead of the bare name.","solutions":["Use a bare environment variable name string, e.g. `token_env: GITHUB_TOKEN`","Drop `${...}` interpolation syntax — just the name","Remove the key if you meant to inline the token with `token` instead"],"exampleFix":"# before\ntoken_env: \"${GITHUB_TOKEN}\"\ntoken_env: [\"GITHUB_TOKEN\"]\n\n# after\ntoken_env: GITHUB_TOKEN","handlingStrategy":"validation","validationCode":"import re\n_ENV_NAME = re.compile(r\"^[A-Za-z_][A-Za-z0-9_]*$\")\ntoken_env = entry.get(\"token_env\")\nif token_env is not None and not _ENV_NAME.match(str(token_env)):\n    raise SystemExit(f\"token_env must be a bare env var name, got {token_env!r}\")","typeGuard":"def is_env_name(value: object) -> bool:\n    return isinstance(value, str) and bool(_ENV_NAME.match(value))","tryCatchPattern":"try:\n    load_auth_config(raw)\nexcept ValueError as exc:\n    if \"'token_env' must be a non-empty string\" in str(exc):\n        # replace ${VAR}/list forms with the bare variable name\n        raise\n    raise","preventionTips":["token_env takes a bare variable name — no ${...} interpolation","Validate env names with a regex before writing the config"],"tags":["authentication","config","validation","environment"],"backgroundTag":null,"analyzedSha":"bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c","analyzedAt":"2026-08-14T19:43:37.150Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}