affaan-m/ECC · error · ValueError
Unknown provider type
Error message
Unknown provider type: {provider_type}. Valid types: {[p.value for p in ProviderType]} What it means
resolver.get_provider() first normalizes the provider_type argument; if it is still a string, it attempts ProviderType(value). On failure it raises ValueError 'Unknown provider type: ...' listing valid enum values. This guards against typo'd or unsupported provider names.
Solutions
- Use a valid ProviderType value string (e.g. 'claude', 'openai', 'ollama') or pass the ProviderType enum directly
- Compare against [p.value for p in ProviderType] to see accepted values
- Validate the config value at load time against the enum
- Fix typos in .env/config files that supply the provider name
Example fix
// before provider = get_provider(config["llm"]) # "Claude" // after provider = get_provider(config["llm"].lower()) # "claude"
Defensive patterns
Strategy: validation
Validate before calling
VALID = {p.value for p in ProviderType}
assert provider_name in VALID, f"{provider_name!r} not in {sorted(VALID)}"
provider = get_provider(provider_name) Type guard
def is_provider_type(v: str) -> bool:
try:
ProviderType(v)
return True
except ValueError:
return False Try / catch
try:
provider = get_provider(provider_type)
except ValueError as e:
logger.error("Bad provider config: %s", e)
provider = get_provider(ProviderType.OPENAI) # safe default Prevention
- Validate provider names from config/env at load time against ProviderType
- Normalize casing/lowercase of config values
- Add a schema validation (pydantic Literal) for provider fields
- Keep config docs listing valid provider values
When it happens
Trigger: Calling get_provider("claud") or get_provider("gpt4") — any string not matching a ProviderType member's value.
Common situations: Reading provider name from config/env with typos; passing display names ('ChatGPT', 'Anthropic') instead of enum values ('openai', 'claude'); config written for an older version whose enum values changed.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- artifact has invalid modality binding
- assigneeKind must be 'agent' or 'human'.
- CV effect has an invalid subject anchor
- explicit candidate review state required
- --host-provider must be anthropic, openai, or unknown
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/81f2665b88275cc1.
Report an issue: GitHub.
Appendix: source
Thrown at src/llm/providers/resolver.py:69
if provider_type is not None:
return provider_type
env_provider = os.environ.get("LLM_PROVIDER")
if env_provider:
return _strip_env_value(env_provider).lower()
saved_config = _read_saved_llm_config()
return saved_config.get("LLM_PROVIDER", "claude").lower()
def get_provider(provider_type: ProviderType | str | None = None, **kwargs: str) -> LLMProvider:
provider_type = _resolve_provider_type(provider_type)
if isinstance(provider_type, str):
try:
provider_type = ProviderType(provider_type)
except ValueError:
raise ValueError(f"Unknown provider type: {provider_type}. Valid types: {[p.value for p in ProviderType]}")
provider_cls = _PROVIDER_MAP.get(provider_type)
if not provider_cls:
raise ValueError(f"No provider registered for type: {provider_type}")
return provider_cls(**kwargs)
def register_provider(provider_type: ProviderType, provider_cls: type[LLMProvider]) -> None:
_PROVIDER_MAP[provider_type] = provider_cls
View on GitHub (pinned to 8321021c54)