{"record":{"id":"60b98b69005ace83","repo":"Panniantong/Agent-Reach","slug":"unknown-provider-provider","errorCode":null,"errorMessage":"unknown provider: {provider}","messagePattern":"unknown provider: (.+?)","errorType":"exception","errorClass":"TranscribeError","httpStatus":null,"severity":"error","filePath":"agent_reach/transcribe.py","lineNumber":370,"sourceCode":"    return chunks\n\n\ndef _provider_key(provider: str, config: Config) -> Optional[str]:\n    field = PROVIDERS[provider][\"key_field\"]\n    val = config.get(field)\n    return val or None\n\n\ndef transcribe_chunk(\n    chunk: Path,\n    provider: str,\n    *,\n    config: Optional[Config] = None,\n    timeout: int = 120,\n) -> str:\n    \"\"\"Transcribe one chunk via the named provider. Raises TranscribeError on failure.\"\"\"\n    if provider not in PROVIDERS:\n        raise TranscribeError(f\"unknown provider: {provider}\")\n    cfg = config or Config()\n    key = _provider_key(provider, cfg)\n    if not key:\n        raise NoProviderConfigured(\n            f\"{provider}: missing {PROVIDERS[provider]['key_field']} \"\n            f\"(configure with `agent-reach configure {provider}-key ...`)\"\n        )\n\n    info = PROVIDERS[provider]\n    with chunk.open(\"rb\") as fh:\n        try:\n            resp = requests.post(\n                info[\"endpoint\"],\n                headers={\"Authorization\": f\"Bearer {key}\"},\n                files={\"file\": (chunk.name, fh, \"audio/m4a\")},\n                data={\"model\": info[\"model\"], \"response_format\": \"text\"},\n                timeout=timeout,\n            )","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/Panniantong/Agent-Reach/blob/93ae1d18c37b707dec053c7c4f9d91cd8ef8943d/agent_reach/transcribe.py#L352-L388","documentation":"Raised by transcribe_chunk (transcribe.py:368-370) when the provider argument is not a key of PROVIDERS ({'groq', 'openai'}). transcribe_chunk handles exactly one concrete provider; the 'auto' pseudo-provider is resolved earlier by _provider_order in transcribe() and must never reach this function.","triggerScenarios":"Direct calls like transcribe_chunk(path, 'deepgram') or transcribe_chunk(path, 'auto') — 'auto' is invalid here because there is nothing to auto-select at chunk level. Valid: 'groq', 'openai'.","commonSituations":"Calling the internal API directly instead of transcribe(); forwarding a user-supplied provider string without validation; version drift after a provider was renamed or removed from PROVIDERS.","solutions":["Use a concrete provider: transcribe_chunk(chunk, 'groq') or transcribe_chunk(chunk, 'openai')","For automatic selection, call transcribe(source, provider='auto') which resolves the order before any chunk is sent","If calling from code, validate against agent_reach.transcribe.PROVIDERS.keys() first"],"exampleFix":"# before\ntranscribe_chunk(chunk, provider=\"auto\")  # unknown provider: auto\n\n# after\nfrom agent_reach.transcribe import PROVIDERS\nassert provider in PROVIDERS, f\"provider must be one of {sorted(PROVIDERS)}\"\ntext = transcribe_chunk(chunk, provider=provider)","handlingStrategy":"type-guard","validationCode":"from agent_reach.transcribe import PROVIDERS\n\ndef is_concrete_provider(name: str) -> bool:\n    return name in PROVIDERS  # {'groq', 'openai'} — 'auto' NOT allowed here","typeGuard":"from agent_reach.transcribe import PROVIDERS\nfrom typing import Literal\n\nConcreteProvider = Literal[\"groq\", \"openai\"]\n\ndef is_concrete_provider(name: str) -> bool:\n    \"\"\"Type guard: True when name is a valid single provider for transcribe_chunk.\"\"\"\n    return isinstance(name, str) and name in PROVIDERS","tryCatchPattern":"from agent_reach.transcribe import TranscribeError\ntry:\n    text = transcribe_chunk(chunk, provider)\nexcept TranscribeError as e:\n    if str(e).startswith(\"unknown provider\"):\n        # caller should have used transcribe(..., provider='auto')\n        return transcribe(source, provider=\"auto\")\n    raise","preventionTips":["Use transcribe() for provider selection; transcribe_chunk() takes concrete providers only","Validate against PROVIDERS.keys() at your boundary — never hardcode the list","Remember 'auto' is invalid for transcribe_chunk by design"],"tags":["validation","provider","api-misuse","transcription"],"backgroundTag":null,"analyzedSha":"93ae1d18c37b707dec053c7c4f9d91cd8ef8943d","analyzedAt":"2026-08-14T22:54:06.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}