{"record":{"id":"dddef97497b2a139","repo":"BerriAI/litellm","slug":"customsecretmanagerexception-key-management-sett","errorCode":null,"errorMessage":"CustomSecretManagerException - key_management_settings is required with custom_secret_manager field","messagePattern":"CustomSecretManagerException - key_management_settings is required with custom_secret_manager field","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/secret_managers/custom_secret_manager_loader.py","lineNumber":37,"sourceCode":"    Load and initialize a custom secret manager from a python file.\n\n    Similar to how custom guardrails are loaded - loads the class from\n    the custom_secret_manager field in key_management_settings.\n\n    Args:\n        config_file_path: Path to the config.yaml file\n\n    Raises:\n        ValueError: If required configuration is missing\n        ImportError: If the custom secret manager module cannot be loaded\n    \"\"\"\n\n    if not config_file_path:\n        raise ValueError(\"CustomSecretManagerException - config_file_path is required to load custom secret manager\")\n\n    # Get the custom_secret_manager class path from settings\n    if litellm._key_management_settings is None:\n        raise ValueError(\n            \"CustomSecretManagerException - key_management_settings is required with custom_secret_manager field\"\n        )\n\n    custom_secret_manager_path: Final = getattr(litellm._key_management_settings, \"custom_secret_manager\", None)\n\n    if not custom_secret_manager_path:\n        raise ValueError(\n            \"CustomSecretManagerException - custom_secret_manager field is required in key_management_settings\"\n        )\n\n    # Split into file_name and class_name (e.g., \"my_secret_manager.InMemorySecretManager\")\n    _file_name, _class_name = custom_secret_manager_path.split(\".\")\n    verbose_proxy_logger.debug(\n        \"Initializing custom secret manager: %s, file_name: %s, class_name: %s\",\n        custom_secret_manager_path,\n        _file_name,\n        _class_name,\n    )","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/secret_managers/custom_secret_manager_loader.py#L19-L55","documentation":"Config guard: custom_secret_manager was requested in the proxy config, but litellm._key_management_settings is None, meaning key management settings were never initialized before the loader ran. Sentinel ValueError for missing global configuration state.","triggerScenarios":"Thrown at litellm/secret_managers/custom_secret_manager_loader.py:37 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a key_management_settings block to the config when specifying custom_secret_manager.","Example: key_management_settings: {custom_secret_manager: my_module.MyClass}."],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}