cube-js/cube · critical

Warehouse is being deleted (current state: ${data.state})

Error message

Warehouse is being deleted (current state: ${data.state})

What it means

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.

Source

Thrown at packages/cubejs-databricks-jdbc-driver/src/DatabricksDriver.ts:404

    if (this.config.properties.OAuth2Secret) {
      const at = await this.getValidAccessToken();
      token = `Bearer ${at}`;
    } else {
      token = `Bearer ${this.config.properties.PWD}`;
    }

    const res = await fetch(`https://${this.parsedConnectionProperties.host}/api/2.0/sql/warehouses/${this.parsedConnectionProperties.warehouseId}`, {
      headers: { Authorization: token },
    });

    if (!res.ok) {
      throw new Error(`Databricks API error: ${res.statusText}`);
    }

    const data = await res.json();

    if (['DELETING', 'DELETED'].includes(data.state)) {
      throw new Error(`Warehouse is being deleted (current state: ${data.state})`);
    }

    // There is also DEGRADED status, but it doesn't mean that cluster is 100% not working...
    if (data.health?.status === 'FAILED') {
      throw new Error(`Warehouse is unhealthy: ${data.health?.summary}. Details: ${data.health?.details}`);
    }
  }

  public override async loadPreAggregationIntoTable(
    preAggregationTableName: string,
    loadSql: string,
    params: unknown[],
    _options: any,
  ) {
    if (this.config.catalog) {
      const [schema] = preAggregationTableName.split('.');
      return super.loadPreAggregationIntoTable(
        preAggregationTableName,

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Create a new SQL warehouse in the Databricks workspace and update the JDBC URL httpPath with the new warehouse id
  2. If the state is DELETING, confirm in the Databricks UI whether the delete is intentional; restore is not possible — provision a replacement
  3. Update CUBEJS_DB_URL/config everywhere it references the stale warehouseId

Example fix

// before
// jdbc url with dead warehouse
// jdbc:databricks://host;httpPath=/sql/1.0/warehouses/abc123dead
// after
// point to the new warehouse id from Databricks UI
// jdbc:databricks://host;httpPath=/sql/1.0/warehouses/<newWarehouseId>
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(`https://${host}/api/2.0/sql/warehouses/${warehouseId}`, { headers: { Authorization: `Bearer ${token}` } });
const data = await res.json();
if (['DELETING','DELETED'].includes(data.state)) throw new Error(`Warehouse ${warehouseId} is ${data.state}; update config`);

Try / catch

try {
  await driver.testConnection();
} catch (e) {
  if (e.message.includes('Warehouse is being deleted')) {
    // fail fast: provisioning/reconfiguration needed, do not retry
  }
  throw e;
}

Prevention

When it happens

Trigger: testConnection reads data.state from GET /api/2.0/sql/warehouses/{id} and it equals 'DELETING' or 'DELETED'.

Common situations: 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.

Related errors


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