BerriAI/litellm · error · ValueError

Missing Snowflake JWT key

Error message

Missing Snowflake JWT key

What it means

Guard in the Snowflake header builder: a Bearer JWT is required to authorize Cortex REST API calls (X-Snowflake-Authorization-Token-Type: KEYPAIR_JWT). Fires when no keypair JWT was generated/passed, e.g. missing private key config for the Snowflake deployment.

Source

Thrown at litellm/llms/snowflake/common_utils.py:21

        self,
        headers: dict,
        JWT: str | None = None,
    ) -> dict:
        """
        Return headers to use for Snowflake completion request

        Snowflake REST API Ref: https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-llm-rest-api#api-reference
        Expected headers:
        {
            "Content-Type": "application/json",
            "Accept": "application/json",
            "Authorization": "Bearer " + <JWT>,
            "X-Snowflake-Authorization-Token-Type": "KEYPAIR_JWT"
        }
        """

        if JWT is None:
            raise ValueError("Missing Snowflake JWT key")

        headers.update(
            {
                "Content-Type": "application/json",
                "Accept": "application/json",
                "Authorization": "Bearer " + JWT,
                "X-Snowflake-Authorization-Token-Type": "KEYPAIR_JWT",
            }
        )
        return headers

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide the Snowflake JWT key (SNOWFLAKE_JWT_KEY) used for authentication.

Example fix

os.environ["SNOWFLAKE_JWT_KEY"] = "<jwt-key>"
Defensive patterns

Strategy: validation

When it happens

Trigger: Triggered when a Snowflake call requires a JWT key but none is configured.

Common situations: See trigger scenarios.


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