{"record":{"id":"1903c3e558672470","repo":"Panniantong/Agent-Reach","slug":"provider-missing-providers-provider-key-fiel","errorCode":null,"errorMessage":"{provider}: missing {PROVIDERS[provider]['key_field']} (configure with `agent-reach configure {provider}-key ...`)","messagePattern":"(.+?): missing (.+?) \\(configure with `agent-reach configure (.+?)-key \\.\\.\\.`\\)","errorType":"exception","errorClass":"NoProviderConfigured","httpStatus":null,"severity":"error","filePath":"agent_reach/transcribe.py","lineNumber":374,"sourceCode":"    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            )\n        except requests.RequestException as e:\n            raise TranscribeError(f\"{provider}: network error: {e}\") from e\n\n    if not resp.ok:","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/Panniantong/Agent-Reach/blob/93ae1d18c37b707dec053c7c4f9d91cd8ef8943d/agent_reach/transcribe.py#L356-L392","documentation":"Raised as NoProviderConfigured (subclass of TranscribeError) by transcribe_chunk (transcribe.py:371-377) when the Config object has no value for the provider's key field — groq_api_key or openai_api_key. It is a pre-flight check: no network request is attempted without credentials, and the message names the exact config field and the configure command.","triggerScenarios":"transcribe_chunk(chunk, 'groq') with no groq_api_key in Config (YAML config or env vars, per agent_reach.config). Fresh installs that never ran `agent-reach configure`, or CI environments where the config file was not carried over.","commonSituations":"New machine/container without ~/.config setup; key stored under a renamed field after a version change; CI running tests that hit the real transcribe path without fixture config.","solutions":["Run: agent-reach configure groq-key <key> (or openai-key) as the message instructs","Or set the env var / config field directly per agent_reach.config conventions, then verify with agent-reach doctor","In code, pass an explicit config: transcribe_chunk(chunk, 'groq', config=Config()) after loading, or pre-check _provider_key('groq', cfg)"],"exampleFix":"# before\ntranscribe_chunk(chunk, \"groq\")  # NoProviderConfigured: missing groq_api_key\n\n# after\n# shell: agent-reach configure groq-key gsk_...\n# or in code:\nfrom agent_reach.config import Config\ncfg = Config()\nif not cfg.get(\"groq_api_key\"):\n    raise RuntimeError(\"set agent-reach configure groq-key first\")\ntext = transcribe_chunk(chunk, \"groq\", config=cfg)","handlingStrategy":"validation","validationCode":"from agent_reach.transcribe import PROVIDERS, _provider_key\nfrom agent_reach.config import Config\n\ndef provider_configured(provider: str, cfg: Config | None = None) -> bool:\n    return _provider_key(provider, cfg or Config()) is not None","typeGuard":null,"tryCatchPattern":"from agent_reach.transcribe import NoProviderConfigured, transcribe_chunk\ntry:\n    text = transcribe_chunk(chunk, \"groq\", config=cfg)\nexcept NoProviderConfigured as e:\n    prompt_user_to_configure(\"groq\")  # never retry without new credentials\n    raise","preventionTips":["Run agent-reach configure groq-key / openai-key at setup and verify with agent-reach doctor","Pre-check keys with _provider_key(provider, Config()) before batch jobs","Catch NoProviderConfigured separately from generic TranscribeError — it is a config problem, not a transient failure"],"tags":["configuration","api-key","provider","transcription"],"backgroundTag":null,"analyzedSha":"93ae1d18c37b707dec053c7c4f9d91cd8ef8943d","analyzedAt":"2026-08-14T22:54:06.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}