Budibase/budibase · error

No snowflake client present to execute query. Run connect()

Error message

No snowflake client present to execute query. Run connect() first to initialise.

What it means

The Snowflake integration's execute() guards on this.client being initialised. If connect() was never run (or failed silently leaving client unset) any query execution throws 'No snowflake client present to execute query. Run connect() first to initialise.' It is a lifecycle error: the integration instance is being used before its connection was established.

Source

Thrown at packages/server/src/integrations/snowflake.ts:116

  async connect() {
    if (this.client?.isUp()) return

    this.config.authenticator = "SNOWFLAKE"
    if (this.config.privateKey) {
      this.config.authenticator = "SNOWFLAKE_JWT"
      this.config.privateKey = this.config.privateKey?.trim()
    }

    this.client = snowflakeSdk.createConnection(this.config)
    const connectAsync = promisify(this.client.connect.bind(this.client))
    return connectAsync()
  }

  async execute(sql: string, bindings?: any[]) {
    return new Promise((resolve, reject) => {
      if (!this.client) {
        throw Error(
          "No snowflake client present to execute query. Run connect() first to initialise."
        )
      }

      this.client.execute({
        sqlText: sql,
        binds: bindings,
        complete: function (
          err: SnowflakeError | undefined,
          statementExecuted: any,
          rows: any
        ) {
          if (err) {
            return reject(err)
          }
          resolve(rows)
        },
      })

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Fix the Snowflake connection config and re-save/re-test the datasource so connect() succeeds.
  2. Verify account identifier, warehouse, database and schema values in the datasource settings.
  3. Ensure queries are only executed after the integration's connect() promise resolves (await it before execute).
  4. Check network egress to the Snowflake account URL — blocked connections can prevent client initialisation.

Example fix

// before
const integration = new SnowflakeIntegration(cfg)
await integration.execute("SELECT 1") // client undefined
// after
await integration.connect(cfg)
await integration.execute("SELECT 1")
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure connection exists before querying
if (!integration.client) {
  await integration.connect(config)
}

Type guard

const isConnected = (i: SnowflakeIntegration): boolean =>
  i.client != null

Try / catch

try {
  await integration.execute(sql, bindings)
} catch (e) {
  if (String(e?.message).includes("No snowflake client present")) {
    await integration.connect(config)
    return integration.execute(sql, bindings) // single reconnect retry
  }
  throw e
}

Prevention

When it happens

Trigger: Calling execute/internalQuery (read, create, buildSchema paths) on a Snowflake integration instance whose connect() never completed — e.g. connection credentials wrong so client assignment never happened, or a query issued against a freshly constructed instance.

Common situations: Snowflake credentials (account/warehouse/username/password) wrong so the async connect failed upstream; config saved without required fields; queries run after a connection was closed/reset; concurrency where one caller reads while connect is still in-flight.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/7c2778e6d146df0b. Report an issue: GitHub.