{"record":{"id":"eb494a421dd72366","repo":"BerriAI/litellm","slug":"custompromptmanagement-is-required-got-type-cust","errorCode":null,"errorMessage":"CustomPromptManagement is required, got {type(custom_prompt_callback)}","messagePattern":"CustomPromptManagement is required, got (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/prompts/prompt_registry.py","lineNumber":139,"sourceCode":"        custom_prompt_callback: CustomPromptManagement | None = None\n        litellm_params_data: Final = prompt.litellm_params\n        verbose_proxy_logger.debug(\"litellm_params= %s\", litellm_params_data)\n\n        if isinstance(litellm_params_data, dict):\n            litellm_params = PromptLiteLLMParams(**litellm_params_data)\n        else:\n            litellm_params = litellm_params_data\n\n        prompt_integration: Final = litellm_params.prompt_integration\n        if prompt_integration is None:\n            raise ValueError(\"prompt_integration is required\")\n\n        initializer: Final = prompt_initializer_registry.get(prompt_integration)\n\n        if initializer:\n            custom_prompt_callback = initializer(litellm_params, prompt)\n            if not isinstance(custom_prompt_callback, CustomPromptManagement):\n                raise ValueError(f\"CustomPromptManagement is required, got {type(custom_prompt_callback)}\")\n            litellm.logging_callback_manager.add_litellm_callback(custom_prompt_callback)\n        else:\n            raise ValueError(f\"Unsupported prompt: {prompt_integration}\")\n\n        parsed_prompt: Final = PromptSpec(\n            prompt_id=prompt_id,\n            litellm_params=litellm_params,\n            prompt_info=prompt.prompt_info or PromptInfo(prompt_type=\"config\"),\n            created_at=prompt.created_at,\n            updated_at=prompt.updated_at,\n        )\n\n        # store references to the prompt in memory\n        self.IN_MEMORY_PROMPTS[prompt_id] = parsed_prompt\n        self.prompt_id_to_custom_prompt[prompt_id] = custom_prompt_callback\n\n        return parsed_prompt\n","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/prompts/prompt_registry.py#L121-L157","documentation":"Type guard during prompt registration: the initializer registered for the prompt_integration returned an object, but it is not an instance of CustomPromptManagement, so the callback contract is violated. The actual type is included in the message; raised as ValueError.","triggerScenarios":"Thrown at litellm/proxy/prompts/prompt_registry.py:139 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a CustomPromptManagement implementation as the custom prompt callback; check the configured class type."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}