{"record":{"id":"61a33ed734cf2130","repo":"BerriAI/litellm","slug":"no-matching-adapter-given-received-adapter-id","errorCode":null,"errorMessage":"No matching adapter given. Received 'adapter_id'={adapter_id}, litellm.adapters={litellm.adapters}","messagePattern":"No matching adapter given\\. Received 'adapter_id'=(.+?), litellm\\.adapters=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/main.py","lineNumber":7389,"sourceCode":"\n    return text_completion_response\n\n\n###### Adapter Completion ################\n\n\nasync def aadapter_completion(*, adapter_id: str, **kwargs) -> BaseModel | AdapterCompletionStreamWrapper | None:\n    \"\"\"\n    Implemented to handle async calls for adapter_completion()\n    \"\"\"\n    try:\n        translation_obj: CustomLogger | None = None\n        for item in litellm.adapters:\n            if item[\"id\"] == adapter_id:\n                translation_obj = item[\"adapter\"]\n\n        if translation_obj is None:\n            raise ValueError(\n                f\"No matching adapter given. Received 'adapter_id'={adapter_id}, litellm.adapters={litellm.adapters}\"\n            )\n\n        new_kwargs: Final = translation_obj.translate_completion_input_params(kwargs=kwargs)\n\n        response: Final[ModelResponse | CustomStreamWrapper] = await acompletion(**new_kwargs)\n        translated_response: BaseModel | AdapterCompletionStreamWrapper | None = None\n        if isinstance(response, ModelResponse):\n            translated_response = translation_obj.translate_completion_output_params(response=response)\n        if isinstance(response, CustomStreamWrapper):\n            translated_response = translation_obj.translate_completion_output_params_streaming(\n                completion_stream=response\n            )\n\n        return translated_response\n    except Exception as e:\n        raise e\n","sourceCodeStart":7371,"sourceCodeEnd":7407,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/main.py#L7371-L7407","documentation":"aadapter_completion() routes by adapter_id through litellm.adapters, a list of {'id', 'adapter'} registrations. When no entry's id equals the given adapter_id, a ValueError is raised echoing the id you passed and the currently registered adapters.","triggerScenarios":"await litellm.aadapter_completion(adapter_id='my_adapter', **kwargs) before appending {'id': 'my_adapter', 'adapter': MyAdapter()} to litellm.adapters; or an id typo such as 'Gemini' vs 'gemini' (matching is exact).","commonSituations":"Using the documented Gemini adapter without registering it first (litellm.adapters.append({'id': 'gemini', 'adapter': GeminiRender()})); registration code that runs after the call or in a different worker process.","solutions":["Register before calling: litellm.adapters.append({'id': 'my_adapter', 'adapter': MyAdapter()})","For Gemini-style requests use the bundled id exactly: adapter_id='gemini'","Match the id string exactly — look it up in litellm.adapters","Centralize adapter registration at application startup"],"exampleFix":"# before\nresp = await litellm.aadapter_completion(adapter_id=\"gemini\", **kwargs)\n\n# after\nfrom litellm.adapters.gemini import GeminiRender\nlitellm.adapters.append({\"id\": \"gemini\", \"adapter\": GeminiRender()})\nresp = await litellm.aadapter_completion(adapter_id=\"gemini\", **kwargs)","handlingStrategy":"validation","validationCode":"import litellm\n\ndef get_adapter(adapter_id: str):\n    for item in litellm.adapters:\n        if item[\"id\"] == adapter_id:\n            return item[\"adapter\"]\n    raise KeyError(f\"adapter {adapter_id!r} not registered; known: {[a['id'] for a in litellm.adapters]}\")","typeGuard":null,"tryCatchPattern":"try:\n    resp = await litellm.aadapter_completion(adapter_id=aid, **kwargs)\nexcept ValueError as e:\n    if \"No matching adapter\" in str(e):\n        raise RuntimeError(f\"adapter {aid!r} not registered\") from e\n    raise","preventionTips":["Register adapters idempotently at app startup","Assert required adapter ids exist before serving traffic"],"tags":["litellm","adapter","adapter-completion","registration"],"backgroundTag":"unknown-adapter","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}