{"record":{"id":"8cf34c1fbd32cb56","repo":"cube-js/cube","slug":"cubejs-db-name-can-t-be-empty","errorCode":null,"errorMessage":"CUBEJS_DB_NAME can`t be empty.","messagePattern":"CUBEJS_DB_NAME can`t be empty\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-dremio-driver/driver/DremioDriver.js","lineNumber":261,"sourceCode":"  }\n\n  async refreshTablesSchema(path) {\n    const { data } = await this.restDremioQuery('get', `/catalog/by-path/${path}`);\n    if (!data || !data.children) {\n      return true;\n    }\n\n    const queries = data.children.map(element => {\n      const url = element.path.join('/');\n      return this.refreshTablesSchema(url);\n    });\n\n    return Promise.all(queries);\n  }\n\n  async tablesSchema() {\n    if (!this.config.database) {\n      throw new Error('CUBEJS_DB_NAME can`t be empty.');\n    }\n\n    // By some reason query generated by super.tablesSchema will return only tables that we usd before\n    // So, function refreshTablesSchema used for get all tables by rest api.\n    // After this, query generated by super.tablesSchema will return all table`s.\n    await this.refreshTablesSchema(this.config.database);\n    return super.tablesSchema();\n  }\n\n  informationSchemaQuery() {\n    const q = `${super.informationSchemaQuery()} AND columns.table_schema NOT IN ('INFORMATION_SCHEMA', 'sys.cache')`;\n    console.log(q);\n    return q;\n  }\n}\n\nmodule.exports = DremioDriver;\nmodule.exports.applyParams = applyParams;","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-dremio-driver/driver/DremioDriver.js#L243-L279","documentation":"DremioDriver.tablesSchema() requires a database name to introspect tables. Before querying Dremio for the table schema it checks this.config.database, which is populated from the CUBEJS_DB_NAME environment variable, and throws this error when it is empty or undefined. Introspection cannot proceed without knowing which Dremio database (source) to inspect.","triggerScenarios":"Calling driver.tablesSchema() (directly or via Cube Store schema introspection) when the driver config was created without a `database` field — typically because CUBEJS_DB_NAME was not set in the environment or the data source config.","commonSituations":"Deploying Cube for Dremio with an incomplete .env file; forgetting to configure CUBEJS_DB_NAME while only setting host/port/user credentials; renaming config keys and dropping `database` from the driver options.","solutions":["Set CUBEJS_DB_NAME in your environment to the Dremio database/source name to introspect.","Alternatively pass `database: '<name>'` explicitly in the driver configuration object.","Verify with a preflight check in your cube.js bootstrap that process.env.CUBEJS_DB_NAME is non-empty when dbType is dremio."],"exampleFix":"// before (.env)\nCUBEJS_DB_HOST=dremio.example.com\nCUBEJS_DB_USER=admin\n# CUBEJS_DB_NAME missing\n// after\nCUBEJS_DB_HOST=dremio.example.com\nCUBEJS_DB_USER=admin\nCUBEJS_DB_NAME=my_dremio_source","handlingStrategy":"validation","validationCode":"if (!process.env.CUBEJS_DB_NAME) {\n  throw new Error('Set CUBEJS_DB_NAME before starting the Dremio driver');\n}","typeGuard":"function hasDatabase(cfg) {\n  return typeof cfg?.database === 'string' && cfg.database.length > 0;\n}","tryCatchPattern":"try {\n  await driver.tablesSchema();\n} catch (e) {\n  if (e.message.includes('CUBEJS_DB_NAME')) {\n    // fix config and retry\n  } else throw e;\n}","preventionTips":["Add a startup config check that fails fast when CUBEJS_DB_NAME is missing for Dremio datasources","Keep all driver env vars in a validated config schema (e.g. with zod/joi)","Document required Dremio env vars in deployment manifests/secrets"],"tags":["configuration","environment","driver","introspection"],"backgroundTag":"missing-env-var","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}