BerriAI/litellm · error · ValueError

CustomPromptManagement is required, got {type(custom_prompt_

Error message

CustomPromptManagement is required, got {type(custom_prompt_callback)}

What it means

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.

Source

Thrown at litellm/proxy/prompts/prompt_registry.py:139

        custom_prompt_callback: CustomPromptManagement | None = None
        litellm_params_data: Final = prompt.litellm_params
        verbose_proxy_logger.debug("litellm_params= %s", litellm_params_data)

        if isinstance(litellm_params_data, dict):
            litellm_params = PromptLiteLLMParams(**litellm_params_data)
        else:
            litellm_params = litellm_params_data

        prompt_integration: Final = litellm_params.prompt_integration
        if prompt_integration is None:
            raise ValueError("prompt_integration is required")

        initializer: Final = prompt_initializer_registry.get(prompt_integration)

        if initializer:
            custom_prompt_callback = initializer(litellm_params, prompt)
            if not isinstance(custom_prompt_callback, CustomPromptManagement):
                raise ValueError(f"CustomPromptManagement is required, got {type(custom_prompt_callback)}")
            litellm.logging_callback_manager.add_litellm_callback(custom_prompt_callback)
        else:
            raise ValueError(f"Unsupported prompt: {prompt_integration}")

        parsed_prompt: Final = PromptSpec(
            prompt_id=prompt_id,
            litellm_params=litellm_params,
            prompt_info=prompt.prompt_info or PromptInfo(prompt_type="config"),
            created_at=prompt.created_at,
            updated_at=prompt.updated_at,
        )

        # store references to the prompt in memory
        self.IN_MEMORY_PROMPTS[prompt_id] = parsed_prompt
        self.prompt_id_to_custom_prompt[prompt_id] = custom_prompt_callback

        return parsed_prompt

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass a CustomPromptManagement implementation as the custom prompt callback; check the configured class type.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at litellm/proxy/prompts/prompt_registry.py:139 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/eb494a421dd72366. Report an issue: GitHub.