cube-js/cube · error

Can't connect to the Snowflake instance: ${JSON.stringify(re

Error message

Can't connect to the Snowflake instance: ${JSON.stringify(rest)}

What it means

Thrown by testConnection after snowflake.connect() and connect() complete when connection.isUp() still returns false — the client library accepted the call but the session is not actually up, and the message embeds the redacted driver config (password stripped) for diagnosis.

Source

Thrown at packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts:453

  private async createConnection() {
    const config = await this.prepareConnectOptions();

    return snowflake.createConnection(config);
  }

  /**
   * Test driver's connection.
   */
  public async testConnection() {
    const connection = await this.createConnection();

    await new Promise(
      (resolve, reject) => connection.connect((err, conn) => (err ? reject(err) : resolve(conn)))
    );
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    const { password, ...rest } = this.config;
    if (!connection.isUp()) {
      throw new Error(`Can't connect to the Snowflake instance: ${JSON.stringify(rest)}`);
    }
    await new Promise(
      (resolve, reject) => connection.destroy((err, conn) => (err ? reject(err) : resolve(conn)))
    );
  }

  /**
   * Values are interpolated rather than bound because Snowflake does not
   * support bind variables in `ALTER SESSION SET` (it rejects `?` with
   * "invalid value [?] for parameter"; see
   * snowflakedb/snowflake-connector-nodejs#315).
   *
   * I've tested it on 04 jun 2026, and it still does not work.
   */
  protected buildAlterSessionSql(params: Record<string, SessionParameterValue>): string {
    const assignments = Object.entries(params)
      .filter(([, value]) => value !== undefined)
      .map(([key, value]) => `${key} = ${typeof value === 'string' ? `'${value}'` : value}`)

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Inspect the JSON in the message to confirm the account, warehouse, database, schema, role, and user values are correct
  2. Verify network reachability of the Snowflake account host and that firewall/proxy settings allow port 443
  3. Check that the Snowflake account is not suspended and that the credentials are valid
  4. Retry the connection — transient network or DNS failures can leave the session down
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts:453 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/eabb7df382ec0df3. Report an issue: GitHub.