High severity beginner · Fix: 2-5 min

ValueError

litellm.config.ValueError: Model alias not found in config

What this error means
LiteLLM throws this error when the specified model alias is missing or undefined in the LiteLLM configuration file or dictionary.

Stack trace

traceback
Traceback (most recent call last):
  File "app.py", line 12, in <module>
    client = LiteLLMClient(model_alias="my-model")  # triggers error
  File "/usr/local/lib/python3.9/site-packages/litellm/client.py", line 45, in __init__
    self.model_config = config.get_model_config(model_alias)
  File "/usr/local/lib/python3.9/site-packages/litellm/config.py", line 30, in get_model_config
    raise ValueError(f"Model alias '{model_alias}' not found in config")
ValueError: Model alias 'my-model' not found in config
QUICK FIX
Verify and add the required model alias to your LiteLLM config before client initialization to resolve the error immediately.

Why it happens

LiteLLM requires a model alias to be defined in its configuration to map to a valid model specification. If the alias provided to the client or loader is not present in the config file or dictionary, LiteLLM cannot resolve which model to load, causing this error.

Detection

Check for ValueError exceptions during LiteLLM client initialization and log the model alias being requested to verify it exists in the config before proceeding.

Causes & fixes

1

The model alias passed to LiteLLM client is not defined in the LiteLLM config file or dictionary.

✓ Fix

Add the missing model alias with its corresponding model details to the LiteLLM configuration before initializing the client.

2

Typo or mismatch in the model alias string used in code versus the config keys.

✓ Fix

Verify and correct the model alias string in your code to exactly match the key defined in the LiteLLM config, including case sensitivity.

3

The LiteLLM config file is not loaded or is empty due to a path or environment variable misconfiguration.

✓ Fix

Ensure the config file path or environment variable is correctly set and the config loads successfully before creating the LiteLLM client.

Code: broken vs fixed

Broken - triggers the error
python
from litellm import LiteLLMClient

client = LiteLLMClient(model_alias="my-model")  # triggers ValueError: Model alias not found in config
response = client.chat("Hello")
print(response)
Fixed - works correctly
python
import os
from litellm import LiteLLMClient

# Set environment variable or ensure config includes 'my-model'
os.environ["LITELLM_CONFIG_PATH"] = "/path/to/litellm_config.yaml"

client = LiteLLMClient(model_alias="my-model")  # fixed: model alias exists in config
response = client.chat("Hello")
print(response)  # prints model response
Added correct config path and ensured 'my-model' alias is defined in LiteLLM config so client can resolve the model alias without error.

Workaround

Catch the ValueError when initializing LiteLLMClient, then fallback to a default model alias known to exist in the config or prompt the user to update the config.

Prevention

Always validate that all model aliases used in code are present and correctly spelled in the LiteLLM configuration before deployment, and automate config validation in CI pipelines.

Python 3.9+ · litellm >=0.1.0 · tested on 0.2.0
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.