{"record":{"id":"4e625e7a9595b7a4","repo":"BerriAI/litellm","slug":"custom-prompt-management-does-not-support-async-co","errorCode":null,"errorMessage":"Custom prompt management does not support async compile prompt helper","messagePattern":"Custom prompt management does not support async compile prompt helper","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/custom_prompt_management.py","lineNumber":75,"sourceCode":"        prompt_id: str | None,\n        prompt_spec: PromptSpec | None,\n        prompt_variables: dict | None,\n        dynamic_callback_params: StandardCallbackDynamicParams,\n        prompt_label: str | None = None,\n        prompt_version: int | None = None,\n    ) -> PromptManagementClient:\n        raise NotImplementedError(\"Custom prompt management does not support compile prompt helper\")\n\n    async def async_compile_prompt_helper(\n        self,\n        prompt_id: str | None,\n        prompt_variables: dict | None,\n        dynamic_callback_params: StandardCallbackDynamicParams,\n        prompt_spec: PromptSpec | None = None,\n        prompt_label: str | None = None,\n        prompt_version: int | None = None,\n    ) -> PromptManagementClient:\n        raise NotImplementedError(\"Custom prompt management does not support async compile prompt helper\")\n","sourceCodeStart":57,"sourceCodeEnd":76,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/custom_prompt_management.py#L57-L76","documentation":"The async twin: async_compile_prompt_helper is a NotImplementedError stub on CustomPromptManagement. Subclasses that only implement sync compilation (or none) will raise this when awaited, telling you the subclass must provide the async implementation.","triggerScenarios":"await handler.async_compile_prompt_helper(...) on a subclass overriding only _compile_prompt_helper or only get_prompt; framework code defaulting to the async API across all prompt managers.","commonSituations":"Migrating a sync prompt integration into an async proxy pipeline; partially-implemented subclasses caught by generic callers.","solutions":["Implement async_compile_prompt_helper in your subclass (async def ... returning PromptManagementClient)","Or call the sync _compile_prompt_helper if that is what your subclass implements","Guard with a capability check before awaiting the helper"],"exampleFix":"# before\nclass MyPrompts(CustomPromptManagement):\n    def _compile_prompt_helper(self, *a, **k): ...  # sync only\nawait manager.async_compile_prompt_helper(...)  # NotImplementedError\n\n# after\nclass MyPrompts(CustomPromptManagement):\n    async def async_compile_prompt_helper(self, prompt_id, prompt_variables, dynamic_callback_params, **k):\n        return PromptManagementClient(prompt=await compile_async(prompt_id, prompt_variables))","handlingStrategy":"type-guard","validationCode":"from litellm.integrations.custom_prompt_management import CustomPromptManagement\n\nif type(manager).async_compile_prompt_helper is CustomPromptManagement.async_compile_prompt_helper:\n    raise NotImplementedError(f'{type(manager).__name__} does not implement async prompt compilation')","typeGuard":"from litellm.integrations.custom_prompt_management import CustomPromptManagement\n\ndef implements_async_compile(manager) -> bool:\n    return type(manager).async_compile_prompt_helper is not CustomPromptManagement.async_compile_prompt_helper","tryCatchPattern":"except NotImplementedError as e:\n    if 'async compile prompt helper' in str(e):\n        call the sync _compile_prompt_helper instead if the subclass implements it\n    raise","preventionTips":["Declare async capability on prompt-manager subclasses and gate generic callers on it","Keep sync and async implementations aligned when overriding","Test both paths in subclass integration tests"],"tags":["notimplementederror","prompt-management","async","subclass-contract","litellm"],"backgroundTag":"abstract-method-not-implemented","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}