{"record":{"id":"8390f01ee67a9f93","repo":"cube-js/cube","slug":"warehouse-is-being-deleted-current-state-data","errorCode":null,"errorMessage":"Warehouse is being deleted (current state: ${data.state})","messagePattern":"Warehouse is being deleted \\(current state: (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"packages/cubejs-databricks-jdbc-driver/src/DatabricksDriver.ts","lineNumber":404,"sourceCode":"    if (this.config.properties.OAuth2Secret) {\n      const at = await this.getValidAccessToken();\n      token = `Bearer ${at}`;\n    } else {\n      token = `Bearer ${this.config.properties.PWD}`;\n    }\n\n    const res = await fetch(`https://${this.parsedConnectionProperties.host}/api/2.0/sql/warehouses/${this.parsedConnectionProperties.warehouseId}`, {\n      headers: { Authorization: token },\n    });\n\n    if (!res.ok) {\n      throw new Error(`Databricks API error: ${res.statusText}`);\n    }\n\n    const data = await res.json();\n\n    if (['DELETING', 'DELETED'].includes(data.state)) {\n      throw new Error(`Warehouse is being deleted (current state: ${data.state})`);\n    }\n\n    // There is also DEGRADED status, but it doesn't mean that cluster is 100% not working...\n    if (data.health?.status === 'FAILED') {\n      throw new Error(`Warehouse is unhealthy: ${data.health?.summary}. Details: ${data.health?.details}`);\n    }\n  }\n\n  public override async loadPreAggregationIntoTable(\n    preAggregationTableName: string,\n    loadSql: string,\n    params: unknown[],\n    _options: any,\n  ) {\n    if (this.config.catalog) {\n      const [schema] = preAggregationTableName.split('.');\n      return super.loadPreAggregationIntoTable(\n        preAggregationTableName,","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-databricks-jdbc-driver/src/DatabricksDriver.ts#L386-L422","documentation":"testConnection polls the warehouse describe API and explicitly rejects when the warehouse state is DELETING or DELETED, because such a warehouse can no longer serve queries. This is a definitive config/infrastructure problem, not a transient failure.","triggerScenarios":"testConnection reads data.state from GET /api/2.0/sql/warehouses/{id} and it equals 'DELETING' or 'DELETED'.","commonSituations":"Warehouse was deleted (manually, via auto-stop termination policies, or by a terraform/CI change) while the Cube config still references its id; the httpPath points at an old warehouse.","solutions":["Create a new SQL warehouse in the Databricks workspace and update the JDBC URL httpPath with the new warehouse id","If the state is DELETING, confirm in the Databricks UI whether the delete is intentional; restore is not possible — provision a replacement","Update CUBEJS_DB_URL/config everywhere it references the stale warehouseId"],"exampleFix":"// before\n// jdbc url with dead warehouse\n// jdbc:databricks://host;httpPath=/sql/1.0/warehouses/abc123dead\n// after\n// point to the new warehouse id from Databricks UI\n// jdbc:databricks://host;httpPath=/sql/1.0/warehouses/<newWarehouseId>","handlingStrategy":"validation","validationCode":"const res = await fetch(`https://${host}/api/2.0/sql/warehouses/${warehouseId}`, { headers: { Authorization: `Bearer ${token}` } });\nconst data = await res.json();\nif (['DELETING','DELETED'].includes(data.state)) throw new Error(`Warehouse ${warehouseId} is ${data.state}; update config`);","typeGuard":null,"tryCatchPattern":"try {\n  await driver.testConnection();\n} catch (e) {\n  if (e.message.includes('Warehouse is being deleted')) {\n    // fail fast: provisioning/reconfiguration needed, do not retry\n  }\n  throw e;\n}","preventionTips":["Pin warehouse ids via infrastructure-as-code so deletes and config updates happen together","Monitor warehouse state in Databricks and alert on DELETING","Replace warehouse ids in config whenever a warehouse is recreated"],"tags":["databricks","configuration","warehouse","lifecycle"],"backgroundTag":"warehouse-not-available","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}