BerriAI/litellm · error · ValueError

CustomSecretManagerException - custom_secret_manager field i

Error message

CustomSecretManagerException - custom_secret_manager field is required in key_management_settings

What it means

Config guard: key_management_settings exists but its custom_secret_manager field is empty/None, so there is no 'file.ClassName' path to import. Sentinel ValueError naming the missing settings field as the faulty input.

Source

Thrown at litellm/secret_managers/custom_secret_manager_loader.py:44

    Raises:
        ValueError: If required configuration is missing
        ImportError: If the custom secret manager module cannot be loaded
    """

    if not config_file_path:
        raise ValueError("CustomSecretManagerException - config_file_path is required to load custom secret manager")

    # Get the custom_secret_manager class path from settings
    if litellm._key_management_settings is None:
        raise ValueError(
            "CustomSecretManagerException - key_management_settings is required with custom_secret_manager field"
        )

    custom_secret_manager_path: Final = getattr(litellm._key_management_settings, "custom_secret_manager", None)

    if not custom_secret_manager_path:
        raise ValueError(
            "CustomSecretManagerException - custom_secret_manager field is required in key_management_settings"
        )

    # Split into file_name and class_name (e.g., "my_secret_manager.InMemorySecretManager")
    _file_name, _class_name = custom_secret_manager_path.split(".")
    verbose_proxy_logger.debug(
        "Initializing custom secret manager: %s, file_name: %s, class_name: %s",
        custom_secret_manager_path,
        _file_name,
        _class_name,
    )

    # Load the module from the same directory as config.yaml
    directory: Final = os.path.dirname(config_file_path)
    module_file_path: Final = os.path.join(directory, _file_name) + ".py"

    spec: Final = importlib.util.spec_from_file_location(_class_name, module_file_path)
    if not spec:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set the custom_secret_manager field inside key_management_settings to the dotted path of your CustomSecretManager subclass.
  2. Confirm the field name is spelled exactly 'custom_secret_manager' in the config.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/secret_managers/custom_secret_manager_loader.py:44 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/571029728ec43cf7. Report an issue: GitHub.