BerriAI/litellm · error · ValueError

No config path set, please set a config path using `litellm.

Error message

No config path set, please set a config path using `litellm.config_path = 'path/to/config.json'`

What it means

config_completion() reads default arguments from a JSON config file whose path must be assigned to litellm.config_path first. When litellm.config_path is None it raises ValueError instead of invoking completion().

Source

Thrown at litellm/main.py:8461

####### HELPER FUNCTIONS ################
## Set verbose to true -> ```litellm.set_verbose = True```
def print_verbose(print_statement):
    try:
        verbose_logger.debug(print_statement)
        if litellm.set_verbose:
            print(print_statement)  # noqa: T201
    except Exception:
        pass


def config_completion(**kwargs):
    if litellm.config_path is not None:
        config_args: Final = read_config_args(litellm.config_path)
        # overwrite any args passed in with config args
        return completion(**kwargs, **config_args)
    else:
        raise ValueError(
            "No config path set, please set a config path using `litellm.config_path = 'path/to/config.json'`"
        )


def stream_chunk_builder_text_completion(chunks: list, messages: list | None = None) -> TextCompletionResponse:
    id: Final = chunks[0]["id"]
    object: Final = chunks[0]["object"]
    created: Final = chunks[0]["created"]
    model: Final = chunks[0]["model"]
    system_fingerprint: Final = chunks[0].get("system_fingerprint", None)
    finish_reason: Final = chunks[-1]["choices"][0]["finish_reason"]
    logprobs: Final = chunks[-1]["choices"][0]["logprobs"]

    content_list: Final = []
    for chunk in chunks:
        choices = chunk["choices"]
        for choice in choices:
            if choice is not None and hasattr(choice, "text") and choice.get("text") is not None:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set the path before calling: litellm.config_path = 'config.json'; then litellm.config_completion(...)
  2. Confirm the path exists and the file is valid JSON — read_config_args reads it on the next line
  3. If you don't need config defaults, call litellm.completion(...) directly instead

Example fix

# before
resp = litellm.config_completion(prompt="hi")

# after
litellm.config_path = "path/to/config.json"
resp = litellm.config_completion(prompt="hi")
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
import litellm

if litellm.config_path is None:
    raise ValueError("litellm.config_path is not set")
if not Path(litellm.config_path).is_file():
    raise ValueError(f"config file missing: {litellm.config_path}")

Try / catch

try:
    resp = litellm.config_completion(prompt="hi")
except ValueError as e:
    if "No config path set" in str(e):
        raise RuntimeError("config_completion used without litellm.config_path") from e
    raise

Prevention

When it happens

Trigger: litellm.config_completion(prompt='hi', model=...) without ever setting litellm.config_path = 'path/to/config.json' in the process.

Common situations: Trying the config-based API for the first time; the path being set in a different module or process than the one calling; the config file moved or deleted after initial setup.

Related errors


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