BerriAI/litellm · error · ValueError
Invalid account_id format
Error message
Invalid account_id format
What it means
Guard in _get_api_base: the account_id popped from optional_params does not match the expected Snowflake account identifier format, so the Cortex endpoint hostname would be invalid and the value is rejected up front.
Source
Thrown at litellm/llms/snowflake/utils.py:65
Returns:
dict: Updated optional_params with supported non-default parameters.
"""
supported_openai_params: Final = self.get_supported_openai_params(model)
for param, value in non_default_params.items():
if param in supported_openai_params:
optional_params[param] = value
return optional_params
def _get_api_base(self, api_base, optional_params):
if not api_base:
if "account_id" in optional_params:
account_id = optional_params.pop("account_id")
else:
account_id = get_secret_str("SNOWFLAKE_ACCOUNT_ID")
if account_id is None:
raise ValueError("Missing snowflake account_id")
if not re.match(r"^[a-zA-Z0-9_-]+$", account_id):
raise ValueError("Invalid account_id format")
api_base = f"https://{account_id}.snowflakecomputing.com/api/v2"
api_base = api_base.rstrip("/")
if not api_base.endswith("/api/v2"):
api_base += "/api/v2"
return api_base
def validate_environment(
self,
headers: dict,
model: str,
messages: list[AllMessageValues],
optional_params: dict,
litellm_params: dict,
api_key: str | None = None,
api_base: str | None = None,
) -> dict:
"""View on GitHub (pinned to 77b7c6c40c)
Solutions
- Use a valid Snowflake account identifier format, e.g. 'orgname-accountname'.
- Check for typos in the account_id.
Example fix
account_id="myorg-myaccount"
Defensive patterns
Strategy: validation
When it happens
Trigger: Triggered when the Snowflake account_id has an invalid format.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/fd52bf2194367744.
Report an issue: GitHub.