{"record":{"id":"43bc2aa7c693f2b0","repo":"cube-js/cube","slug":"incorrect-format-for-tablename-should-be-in","errorCode":null,"errorMessage":"Incorrect format for '${tableName}'. Should be in '<schema>.<table>' format","messagePattern":"Incorrect format for '(.+?)'\\. Should be in '<schema>\\.<table>' format","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-schema-compiler/src/scaffolding/ScaffoldingSchema.ts","lineNumber":248,"sourceCode":"      cube: this.options.snakeCase ? toSnakeCase(table) : inflection.camelize(table),\n      tableName,\n      schema,\n      table,\n      measures: this.numberMeasures(tableDefinition),\n      dimensions,\n      joins: includeJoins ? this.joins(tableName, tableDefinition) : []\n    };\n  }\n\n  protected parseTableName(tableName: TableName): [string, string] {\n    let schemaAndTable;\n    if (Array.isArray(tableName)) {\n      schemaAndTable = tableName;\n    } else {\n      schemaAndTable = tableName.match(/([\"`].*?[\"`]|[^`\".]+)+(?=\\s*|\\s*$)/g);\n    }\n    if (schemaAndTable.length !== 2) {\n      throw new UserError(`Incorrect format for '${tableName}'. Should be in '<schema>.<table>' format`);\n    }\n    return schemaAndTable;\n  }\n\n  protected dimensions(tableDefinition: ColumnData[]): Dimension[] {\n    return this.dimensionColumns(tableDefinition).map(column => {\n      const res: Dimension = {\n        name: column.name,\n        types: [column.columnType || this.columnType(column)],\n        title: inflection.titleize(column.name),\n      };\n\n      if (column.columnType !== 'time') {\n        res.isPrimaryKey = column.attributes?.includes('primaryKey') ||\n          this.fixCase(column.name) === 'id';\n      }\n      return res;\n    });","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-schema-compiler/src/scaffolding/ScaffoldingSchema.ts#L230-L266","documentation":"parseTableName expects a table reference containing exactly two segments (schema and table). If the string does not parse into exactly 2 parts — e.g. no dot at all, or extra dotted parts — this UserError is thrown.","triggerScenarios":"Passing 'orders' (no schema), 'a.b.c' (too many segments), or an empty/whitespace string to any API that resolves a table name during scaffolding.","commonSituations":"Users submit a table selection without a schema qualifier in the Playground generate-schema flow, or programmatically pass a bare table name assuming a default schema will be applied.","solutions":["Prefix the table with its schema: 'public.orders'","If the name itself contains dots, pass ['schema','table'] as an array instead of a string","Trim stray whitespace/quotes from the table reference before calling","Check upstream UI/config that builds the table string for missing schema defaults"],"exampleFix":"// before\nschema.resolveTableDefinition('orders');\n// after\nschema.resolveTableDefinition('public.orders');\n// or\nschema.resolveTableDefinition(['public', 'orders']);","handlingStrategy":"validation","validationCode":"function assertQualifiedTable(t) {\n  if (Array.isArray(t)) { if (t.length !== 2) throw new Error('Expected [schema, table]'); return; }\n  const parts = String(t).split('.');\n  if (parts.length !== 2 || !parts[0] || !parts[1]) throw new Error(`Table ref '${t}' must be '<schema>.<table>'`);\n}","typeGuard":"const isQualifiedTableName = (t: unknown): t is string => typeof t === 'string' && /^[^.\"]+\\.[^.\"+]+$/.test(t.trim());","tryCatchPattern":"try { schema.resolveTableDefinition(tableName); } catch (e) { if (e instanceof UserError && e.message.includes('Incorrect format')) { /* apply default schema and retry */ } else throw e; }","preventionTips":["Apply a default schema when the UI provides a bare table name","Use the ['schema','table'] array form for programmatic calls","Trim user input before passing it","Never concatenate qualified names with extra dotted segments"],"tags":["scaffolding","validation","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"}