headroomlabs-ai/headroom · error · ValueError

Unknown provider: {provider}

Error message

Unknown provider: {provider}

What it means

In the CCR batch processor, continuation calls are dispatched per provider: 'anthropic', 'openai', or 'google'. Any other provider string reaching _continue_for (batch_processor.py:321) hits the else branch and raises ValueError. The value flows in from the provider field of a batch request/context, so the error indicates a batch entry carrying a provider the dispatcher does not know.

Source

Thrown at headroom/ccr/batch_processor.py:321

            messages: The messages including tool results.
            tools: The tools list.
            request_context: The request context.
            batch_context: The batch context.
            provider: The provider type.

        Returns:
            The API response.
        """
        if provider == "anthropic":
            return await self._anthropic_continuation(
                messages, tools, request_context, batch_context
            )
        elif provider == "openai":
            return await self._openai_continuation(messages, tools, request_context, batch_context)
        elif provider == "google":
            return await self._google_continuation(messages, tools, request_context, batch_context)
        else:
            raise ValueError(f"Unknown provider: {provider}")

    async def _anthropic_continuation(
        self,
        messages: list[dict[str, Any]],
        tools: list[dict[str, Any]] | None,
        request_context: BatchRequestContext,
        batch_context: BatchContext,
    ) -> dict[str, Any]:
        """Make Anthropic continuation call."""
        url = f"{self.api_urls['anthropic']}/v1/messages"

        headers = {
            "Content-Type": "application/json",
            "anthropic-version": "2023-06-01",
        }
        if batch_context.api_key:
            headers["x-api-key"] = batch_context.api_key

View on GitHub (pinned to 322425c43b)

Solutions

  1. Set the request's provider to one of 'anthropic', 'openai', 'google' (exact lowercase)
  2. Normalize/strip provider strings at ingestion: provider.strip().lower() before dispatch
  3. If you need a new provider, implement a _<provider>_continuation method and add an elif branch in the dispatcher
  4. Check the batch file/context for typos in the provider field

Example fix

# before
resp = await bp._continue_for(provider="Azure", ...)  # ValueError: Unknown provider: Azure

# after
resp = await bp._continue_for(provider="openai", ...)
Defensive patterns

Strategy: type-guard

Validate before calling

SUPPORTED_PROVIDERS = {"anthropic", "openai", "google"}
provider = provider.strip().lower() if provider else ""
if provider not in SUPPORTED_PROVIDERS:
    raise ValueError(f"unsupported provider {provider!r}; expected one of {sorted(SUPPORTED_PROVIDERS)}")

Type guard

from typing import Literal
Provider = Literal["anthropic", "openai", "google"]

def is_supported_provider(p: str) -> TypeGuard[Provider]:
    return p in {"anthropic", "openai", "google"}

Try / catch

try:
    resp = await processor._continue_for(provider=provider, ...)
except ValueError as e:
    if "Unknown provider" in str(e):
        reject_batch_entry(entry, reason=str(e))
    else:
        raise

Prevention

When it happens

Trigger: Submitting a batch request whose provider field is not exactly one of the three supported lowercase strings — e.g. 'azure', 'bedrock', 'mistral', 'ANTHROPIC' (wrong case), or 'openai-compatible'.

Common situations: Adding a new provider to a config but not to the dispatcher; case or whitespace mismatches from user-edited batch JSON; forwarding a vendor-alias provider name from an upstream gateway.

Related errors


AI-assisted analysis of headroomlabs-ai/headroom@322425c43b (2026-08-15). Data as JSON: /api/errors/c92fb586a40689b7. Report an issue: GitHub.