BerriAI/litellm · error · ValueError

Missing snowflake account_id

Error message

Missing snowflake account_id

What it means

Guard in _get_api_base: no explicit api_base was supplied and no account_id was provided in optional_params, so the Cortex REST URL (https://<account_id>.snowflakecomputing.com/...) cannot be constructed.

Source

Thrown at litellm/llms/snowflake/utils.py:63

            model (str): Model name for parameter support check.

        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,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide the Snowflake account_id via parameter or environment variable.

Example fix

os.environ["SNOWFLAKE_ACCOUNT"] = "<account_id>"
Defensive patterns

Strategy: validation

When it happens

Trigger: Triggered when a Snowflake call is made without an account_id.

Common situations: See trigger scenarios.


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