BerriAI/litellm · error · HTTPException
Can't edit model. Model in config. Store model in db via `/m
Error message
Can't edit model. Model in config. Store model in db via `/model/new`. to edit.
What it means
Source-of-truth guard on model update: the model_id exists in the live router but has no DB row, meaning it was defined in config.yaml. Config-defined models are immutable via the API — they must be edited in config and reloaded, or migrated to the DB via /model/new.
Source
Thrown at litellm/proxy/management_endpoints/model_management_endpoints.py:1929
detail={
"error": "No DB Connected. Here's how to do it - https://docs.litellm.ai/docs/proxy/virtual_keys"
},
)
_model_id: str | None = None
_model_info: Final = getattr(model_params, "model_info", None)
if _model_info is None:
raise Exception("model_info not provided")
_model_id = _model_info.id
if _model_id is None:
raise Exception("model_info.id not provided")
_existing_litellm_params = await ModelRepository(prisma_client).table.find_unique(where={"model_id": _model_id})
if _existing_litellm_params is None:
if llm_router is not None and llm_router.get_deployment(model_id=_model_id) is not None:
raise HTTPException(
status_code=400,
detail={"error": "Can't edit model. Model in config. Store model in db via `/model/new`. to edit."},
)
else:
raise Exception("model not found")
deployment: Final = Deployment(**_existing_litellm_params.model_dump())
await ModelManagementAuthChecks.can_user_make_model_call(
model_params=deployment,
user_api_key_dict=user_api_key_dict,
prisma_client=prisma_client,
premium_user=premium_user,
)
_raise_on_strategy_router_write_violation(
incoming_params=model_params.litellm_params,
existing_params=deployment.litellm_params,
)View on GitHub (pinned to 77b7c6c40c)
Solutions
- Store the model in the database via /model/new first; config-file models cannot be edited via this endpoint.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/management_endpoints/model_management_endpoints.py:1929 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/70040f5c65a9f011.
Report an issue: GitHub.