{"record":{"id":"3a11e39b2f42ba89","repo":"BerriAI/litellm","slug":"customsecretmanagerexception-class-name-must","errorCode":null,"errorMessage":"CustomSecretManagerException - {_class_name} must be a subclass of CustomSecretManager","messagePattern":"CustomSecretManagerException - (.+?) must be a subclass of CustomSecretManager","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"litellm/secret_managers/custom_secret_manager_loader.py","lineNumber":71,"sourceCode":"        _file_name,\n        _class_name,\n    )\n\n    # Load the module from the same directory as config.yaml\n    directory: Final = os.path.dirname(config_file_path)\n    module_file_path: Final = os.path.join(directory, _file_name) + \".py\"\n\n    spec: Final = importlib.util.spec_from_file_location(_class_name, module_file_path)\n    if not spec:\n        raise ImportError(f\"Could not find a module specification for {module_file_path}\")\n\n    module: Final = importlib.util.module_from_spec(spec)\n    spec.loader.exec_module(module)\n    _secret_manager_class: Final = getattr(module, _class_name)\n\n    # Validate that it's a CustomSecretManager subclass\n    if not issubclass(_secret_manager_class, CustomSecretManager):\n        raise TypeError(f\"CustomSecretManagerException - {_class_name} must be a subclass of CustomSecretManager\")\n\n    # Instantiate the custom secret manager\n    _secret_manager_instance: Final = _secret_manager_class()\n\n    # Set it as the secret manager client\n    litellm.secret_manager_client = _secret_manager_instance\n\n    # Set the key management system to CUSTOM so get_secret knows to use it\n    litellm._key_management_system = KeyManagementSystem.CUSTOM\n\n    verbose_proxy_logger.info(\n        \"Successfully initialized custom secret manager: %s\",\n        custom_secret_manager_path,\n    )\n","sourceCodeStart":53,"sourceCodeEnd":86,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/secret_managers/custom_secret_manager_loader.py#L53-L86","documentation":"ImportError raised after loading the custom manager module: the class named in the 'file.ClassName' config path exists but does not inherit from CustomSecretManager, so it cannot be used as a secret manager. Type-guard on the dynamically imported class.","triggerScenarios":"Thrown at litellm/secret_managers/custom_secret_manager_loader.py:71 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make {_class_name} inherit from litellm.secret_managers.base_secret_manager.CustomSecretManager.","Implement the required abstract methods (async_read_secret, async_write_secret, etc.) on the subclass."],"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"}