BerriAI/litellm · error · ImportError

Failed to load custom logger from {remote_url}: {e}

Error message

Failed to load custom logger from {remote_url}: {e}

What it means

Generic wrapper around the whole remote-module load: download, spec creation, exec_module, or getattr on the instance name failed, or a pre-download validation error propagated. The chained original exception ('{e}') identifies the actual step; raised as ImportError to signal custom-logger load failure.

Source

Thrown at litellm/proxy/types_utils/utils.py:182

            raise ImportError(f"Could not create module spec for {local_file_path}")

        module: Final = importlib.util.module_from_spec(spec)
        spec.loader.exec_module(module)

        # Get the instance
        instance: Final = getattr(module, instance_name)

        # Clean up the temporary file
        try:
            os.remove(local_file_path)
        except Exception as cleanup_error:
            verbose_proxy_logger.warning("Could not clean up temporary file %s: %s", local_file_path, cleanup_error)

        verbose_proxy_logger.info("Successfully loaded custom logger from %s", remote_url)
        return instance

    except Exception as e:
        raise ImportError(f"Failed to load custom logger from {remote_url}: {e}") from e


async def _download_gcs_file_wrapper(bucket_name: str, object_key: str, local_file_path: str) -> bool:
    """Wrapper for GCS download to handle async properly"""
    try:
        from litellm.proxy.common_utils.load_config_utils import (
            download_python_file_from_gcs,
        )

        return await download_python_file_from_gcs(bucket_name, object_key, local_file_path)
    except Exception as e:
        from litellm._logging import verbose_proxy_logger

        verbose_proxy_logger.error("Error downloading from GCS: %s", e)
        return False


def validate_custom_validate_return_type(

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check the remote URL format, cloud credentials, and the underlying exception in the logs.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/proxy/types_utils/utils.py:182 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/2f15e3b9e69020ab. Report an issue: GitHub.