{"record":{"id":"7c2778e6d146df0b","repo":"Budibase/budibase","slug":"no-snowflake-client-present-to-execute-query-run","errorCode":null,"errorMessage":"No snowflake client present to execute query. Run connect() first to initialise.","messagePattern":"No snowflake client present to execute query\\. Run connect\\(\\) first to initialise\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/server/src/integrations/snowflake.ts","lineNumber":116,"sourceCode":"\n  async connect() {\n    if (this.client?.isUp()) return\n\n    this.config.authenticator = \"SNOWFLAKE\"\n    if (this.config.privateKey) {\n      this.config.authenticator = \"SNOWFLAKE_JWT\"\n      this.config.privateKey = this.config.privateKey?.trim()\n    }\n\n    this.client = snowflakeSdk.createConnection(this.config)\n    const connectAsync = promisify(this.client.connect.bind(this.client))\n    return connectAsync()\n  }\n\n  async execute(sql: string, bindings?: any[]) {\n    return new Promise((resolve, reject) => {\n      if (!this.client) {\n        throw Error(\n          \"No snowflake client present to execute query. Run connect() first to initialise.\"\n        )\n      }\n\n      this.client.execute({\n        sqlText: sql,\n        binds: bindings,\n        complete: function (\n          err: SnowflakeError | undefined,\n          statementExecuted: any,\n          rows: any\n        ) {\n          if (err) {\n            return reject(err)\n          }\n          resolve(rows)\n        },\n      })","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/integrations/snowflake.ts#L98-L134","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the Snowflake connection config and re-save/re-test the datasource so connect() succeeds.","Verify account identifier, warehouse, database and schema values in the datasource settings.","Ensure queries are only executed after the integration's connect() promise resolves (await it before execute).","Check network egress to the Snowflake account URL — blocked connections can prevent client initialisation."],"exampleFix":"// before\nconst integration = new SnowflakeIntegration(cfg)\nawait integration.execute(\"SELECT 1\") // client undefined\n// after\nawait integration.connect(cfg)\nawait integration.execute(\"SELECT 1\")","handlingStrategy":"try-catch","validationCode":"// ensure connection exists before querying\nif (!integration.client) {\n  await integration.connect(config)\n}","typeGuard":"const isConnected = (i: SnowflakeIntegration): boolean =>\n  i.client != null","tryCatchPattern":"try {\n  await integration.execute(sql, bindings)\n} catch (e) {\n  if (String(e?.message).includes(\"No snowflake client present\")) {\n    await integration.connect(config)\n    return integration.execute(sql, bindings) // single reconnect retry\n  }\n  throw e\n}","preventionTips":["Always await connect() before any query path","Verify Snowflake credentials/account so connect() succeeds","Reconnect after any explicit close() or connection reset","Avoid sharing an integration instance across concurrent init flows"],"tags":["snowflake","connection","lifecycle","integration"],"backgroundTag":"client-not-initialised","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}