cube-js/cube · error · UserError
Can't find any table with '${tableName}' name
Error message
Can't find any table with '${tableName}' name What it means
Thrown by ScaffoldingSchema.resolveTableName() when given a bare table name (no schema part) that cannot be found in the supplied dbSchema — neither the exact name nor its inflected (pluralized/tableized) form exists in any schema. The scaffolding tool needs the table's columns to generate a cube, so it fails with a UserError.
Source
Thrown at packages/cubejs-schema-compiler/src/scaffolding/ScaffoldingSchema.ts:149
public resolveTableName(tableName: TableName) {
let tableParts;
if (Array.isArray(tableName)) {
tableParts = tableName;
} else {
tableParts = tableName.match(/(["`].*?["`]|[^`".]+)+(?=\s*|\s*$)/g);
}
if (tableParts.length === 2) {
this.resolveTableDefinition(tableName);
return tableName;
} else if (tableParts.length === 1 && typeof tableName === 'string') {
const schema = Object.keys(this.dbSchema).find(
(tableSchema) => this.dbSchema[tableSchema][tableName] ||
this.dbSchema[tableSchema][inflection.tableize(tableName)]
);
if (!schema) {
throw new UserError(`Can't find any table with '${tableName}' name`);
}
if (this.dbSchema[schema][tableName]) {
return `${schema}.${tableName}`;
}
if (this.dbSchema[schema][inflection.tableize(tableName)]) {
return `${schema}.${inflection.tableize(tableName)}`;
}
}
throw new UserError(
'Table names should be in <table> or <schema>.<table> format'
);
}
public cubeDescriptors(tableNames: TableName[]): CubeDescriptor[] {
const cubes = this.generateForTables(tableNames);
function member(type: MemberType) {View on GitHub (pinned to 7d981676b3)
Solutions
- Verify the exact table name against the database (\dt or information_schema.tables) and correct the spelling/case
- Pass the fully qualified 'schema.table' name instead of the bare name
- Confirm the Cube driver's dbSchema/metadata actually includes the table (check connection and schema-search settings)
- If you reference a singular name, ensure inflection.tableize() pluralizes to the real table (users -> users; person -> people); use the real name otherwise
Example fix
// before scaffoldingTableNames: ["user"] // db has 'users' // after (either) scaffoldingTableNames: ["users"] scaffoldingTableNames: ["public.users"]
Defensive patterns
Strategy: validation
Validate before calling
function assertTableExists(tableName, dbSchema) {
const inflection = require('inflection');
if (String(tableName).includes('.')) return; // qualified name: checked elsewhere
const found = Object.keys(dbSchema).some(s =>
dbSchema[s][tableName] || dbSchema[s][inflection.tableize(tableName)]);
if (!found) throw new Error(`Table '${tableName}' not present in driver metadata`);
} Try / catch
try {
const resolved = scaffoldingSchema.resolveTableName('users');
} catch (e) {
if (e instanceof UserError && e.message.includes("Can't find any table")) {
throw new Error('Verify table name/connection; or pass schema.table');
}
throw e;
} Prevention
- Cross-check table names against information_schema.tables for the connected DB
- Use exact case-sensitive names or fully qualified schema.table form
- Ensure the driver has permission to read schema metadata (dbSchema is populated)
- Remember inflection pluralization: singular names only work if tableize() matches the real table
When it happens
Trigger: Running schema scaffolding (cube scaffolding / generateDataModel) with a TableName like 'users' while dbSchema (populated from driver metadata via metaData() / tablesSchema) contains no matching table in any schema, including after inflection.tableize('users').
Common situations: Typo in the table name, querying the wrong database/connection, table living in a non-searched schema, case-sensitive names (Users vs users), or driver metadata not yet loaded/empty (missing permissions to read schema).
Related errors
- Table names should be in <table> or <schema>.<table> format
- Can't resolve ${tableName}: '${schema}' does not exist
- Can't resolve ${tableName}: '${table}' does not exist
- A user's selector doesn't match any of the pre-aggregations
- Unable to create schema, Druid does not support it
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/167575cec42cfdbd.
Report an issue: GitHub.