{"record":{"id":"5458eb7fac1f098b","repo":"cube-js/cube","slug":"table-names-should-be-in-table-or-schema-tabl","errorCode":null,"errorMessage":"Table names should be in <table> or <schema>.<table> format","messagePattern":"Table names should be in <table> or <schema>\\.<table> format","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-schema-compiler/src/scaffolding/ScaffoldingSchema.ts","lineNumber":159,"sourceCode":"      this.resolveTableDefinition(tableName);\n      return tableName;\n    } else if (tableParts.length === 1 && typeof tableName === 'string') {\n      const schema = Object.keys(this.dbSchema).find(\n        (tableSchema) => this.dbSchema[tableSchema][tableName] ||\n          this.dbSchema[tableSchema][inflection.tableize(tableName)]\n      );\n      if (!schema) {\n        throw new UserError(`Can't find any table with '${tableName}' name`);\n      }\n      if (this.dbSchema[schema][tableName]) {\n        return `${schema}.${tableName}`;\n      }\n      if (this.dbSchema[schema][inflection.tableize(tableName)]) {\n        return `${schema}.${inflection.tableize(tableName)}`;\n      }\n    }\n\n    throw new UserError(\n      'Table names should be in <table> or <schema>.<table> format'\n    );\n  }\n\n  public cubeDescriptors(tableNames: TableName[]): CubeDescriptor[] {\n    const cubes = this.generateForTables(tableNames);\n\n    function member(type: MemberType) {\n      return (value: Omit<CubeDescriptorMember, 'memberType'>) => ({\n        memberType: type,\n        ...R.pick(['name', 'title', 'types', 'isPrimaryKey', 'included', 'isId'], value)\n      });\n    }\n\n    return cubes.map((cube) => ({\n      cube: cube.cube,\n      tableName: cube.tableName,\n      table: cube.table,","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-schema-compiler/src/scaffolding/ScaffoldingSchema.ts#L141-L177","documentation":"Thrown by ScaffoldingSchema.resolveTableName() as the fall-through error when the table name string splits into something other than 1 or 2 dot-separated parts (e.g. 'a.b.c' three-part names, or empty/malformed names). Table names for scaffolding must be either '<table>' or '<schema>.<table>'.","triggerScenarios":"Calling resolveTableName (directly or via cubeDescriptors/generateForTables) with a TableName string like 'db.schema.table', a quoted multi-part name, an empty string, or an Array tableName whose parsed parts length > 2.","commonSituations":"Users paste fully-qualified names from other tools (catalog.schema.table in SQL Server / BigQuery project.dataset.table), pass JDBC-style identifiers, or accidentally include whitespace/quotes so the regex splits into 3+ parts.","solutions":["Pass only '<table>' or '<schema>.<table>' — drop the database/catalog prefix (e.g. 'myschema.mytable' not 'mydb.myschema.mytable')","Ensure the connection is configured to the right database so the catalog part is unnecessary","Strip stray quotes, brackets, or whitespace from the table-name string before scaffolding","For BigQuery-style project.dataset.table, configure the project in the driver and use 'dataset.table'"],"exampleFix":"// before\nscaffoldingTableNames: [\"mydb.public.users\"]\n// after\nscaffoldingTableNames: [\"public.users\"]","handlingStrategy":"validation","validationCode":"function assertTableNameFormat(name) {\n  if (typeof name !== 'string') throw new Error('tableName must be a string or [schema, table] array');\n  const parts = name.split('.').filter(Boolean);\n  if (parts.length < 1 || parts.length > 2) {\n    throw new Error(`'${name}' must be <table> or <schema>.<table>`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  scaffoldingSchema.resolveTableName(tableName);\n} catch (e) {\n  if (e instanceof UserError && e.message.includes('<table> or <schema>.<table>')) {\n    throw new Error('Drop the catalog/database prefix and pass schema.table');\n  }\n  throw e;\n}","preventionTips":["Never pass three-part names (db.schema.table); configure the database in the driver instead","Strip quotes/brackets/whitespace from identifiers before scaffolding","Use an array [schema, table] if your source system gives multi-part names","Validate name format at config-load time, before invoking scaffolding"],"tags":["scaffolding","schema","validation","table-name-format"],"backgroundTag":"invalid-table-name-format","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}