BerriAI/litellm · error · NotImplementedError

Delete operations are not implemented for {self.secret_manag

Error message

Delete operations are not implemented for {self.secret_manager_name}. Override async_delete_secret() to add delete support.

What it means

async_delete_secret on CustomSecretManager is the delete-path optional-capability stub: it raises NotImplementedError naming the manager and telling you to override async_delete_secret. Like the write stub, it exists so read-only managers fail loudly instead of silently pretending to delete.

Source

Thrown at litellm/integrations/custom_secret_manager.py:208

        """
        Asynchronously delete a secret from your custom secret manager.

        This is optional to implement. If your secret manager supports deleting secrets,
        you can override this method.

        Args:
            secret_name: Name of the secret to delete
            recovery_window_in_days: Number of days before permanent deletion (if supported)
            optional_params: Additional parameters specific to your secret manager
            timeout: Request timeout

        Returns:
            Response from the secret manager containing deletion details

        Raises:
            NotImplementedError: If delete operations are not supported
        """
        raise NotImplementedError(
            f"Delete operations are not implemented for {self.secret_manager_name}. "
            "Override async_delete_secret() to add delete support."
        )

    def validate_environment(self) -> bool:
        """
        Validate that all required environment variables and configuration are present.

        Override this method to validate your secret manager's configuration.

        Returns:
            True if the environment is valid

        Raises:
            ValueError: If required configuration is missing
        """
        verbose_logger.debug("No environment validation configured for custom secret manager")
        return True

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Override async_delete_secret in your subclass to invoke your backend's delete API (respecting recovery_window_in_days if supported)
  2. Gate deletion flows on a capability check so read-only managers are skipped
  3. Switch to a backend with delete support for anything under rotation policies

Example fix

# before
await mgr.async_delete_secret('MY_KEY')  # NotImplementedError: Override async_delete_secret()

# after
class MyManager(CustomSecretManager):
    async def async_delete_secret(self, secret_name, recovery_window_in_days=7, optional_params=None, timeout=None):
        return await backend.delete_secret(secret_name, recovery_window_in_days)
Defensive patterns

Strategy: type-guard

Validate before calling

from litellm.integrations.custom_secret_manager import CustomSecretManager

if type(manager).async_delete_secret is CustomSecretManager.async_delete_secret:
    raise PermissionError(f'{manager.secret_manager_name} is read-only; skipping delete')

Type guard

from litellm.integrations.custom_secret_manager import CustomSecretManager

def can_delete_secrets(manager) -> bool:
    return type(manager).async_delete_secret is not CustomSecretManager.async_delete_secret

Try / catch

except NotImplementedError as e:
    if 'async_delete_secret' in str(e):
        skip deletion for read-only managers and log which secrets remain; never report success
    raise

Prevention

When it happens

Trigger: await manager.async_delete_secret(secret_name) on a subclass without a delete implementation; cleanup/rotation scripts calling delete on every configured manager regardless of capability.

Common situations: Secret rotation tooling that writes and deletes across managers; read-only wrappers (env, cached KV) exposed to generic lifecycle jobs.

Understand the failure class

Background: "NotImplementedError: Subclasses should override this method" / "must be implemented" — abstract method errors explained — this error's family across 40 libraries.

Related errors


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