BerriAI/litellm · error · ImportError
Could not import {instance_name} from {module_name}
Error message
Could not import {instance_name} from {module_name} What it means
The module (file-based or importable) loaded successfully, but getattr failed: the final dotted component of the value does not name any attribute in that module. The caller misspelled the instance/function name or the module does not export it.
Source
Thrown at litellm/proxy/types_utils/utils.py:61
if module_file_path is not None and os.path.exists(module_file_path):
spec: Final = importlib.util.spec_from_file_location(module_name, module_file_path)
if spec is None:
raise ImportError(f"Could not find a module specification for {module_file_path}")
module = importlib.util.module_from_spec(spec)
if spec.loader is None:
raise ImportError(f"Could not find a module loader for {module_file_path}")
spec.loader.exec_module(module)
else:
module = importlib.import_module(module_name)
# Get the instance from the module
instance: Final = getattr(module, instance_name)
return instance
except ImportError as e:
# Re-raise the exception with a user-friendly message
if instance_name and module_name:
raise ImportError(f"Could not import {instance_name} from {module_name}") from e
else:
raise e
except Exception as e:
raise e
def _load_instance_from_remote_storage(remote_url: str, config_file_path: str | None = None) -> Any:
"""
Load custom logger instance from S3 or GCS URL.
Expected format:
- s3://bucket-name/path/to/module.instance_name
- gcs://bucket-name/path/to/module.instance_name
Args:
remote_url (str): The s3:// or gcs:// URL
config_file_path (str): Optional config file path for temp directory context
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Confirm the module defines an attribute with the given instance name and the module imports without errors.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/types_utils/utils.py:61 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/d8c3e3a348df1794.
Report an issue: GitHub.