nocobase/nocobase · warning
Can not find collection by table name ${JSON.stringify(row)}
Error message
Can not find collection by table name ${JSON.stringify(row)}, current collections: ${Array.from(db.tableNameCollectionMap.keys()).join(', ')} What it means
After a repository find on an inherited-collection query, this listener maps each row's __schemaName/__tableName back to a collection via db.tableNameCollectionMap. When no collection matches the row's physical table name, the row is skipped with this warning instead of crashing.
Source
Thrown at packages/core/database/src/listeners/append-child-collection-name-after-repository-find.ts:47
}
return;
}
if (dataCollection.isParent()) {
for (const row of data) {
if (row.__collection) {
continue;
}
const fullTableName = findOptions.raw
? `${row['__schemaName']}.${row['__tableName']}`
: `${row.get('__schemaName')}.${row.get('__tableName')}`;
const rowCollection = db.tableNameCollectionMap.get(fullTableName);
if (!rowCollection) {
db.logger.warn(
`Can not find collection by table name ${JSON.stringify(row)}, current collections: ${Array.from(
db.tableNameCollectionMap.keys(),
).join(', ')}`,
);
return;
}
const rowCollectionName = rowCollection.name;
setRowAttribute(row, '__collection', rowCollectionName, findOptions.raw);
}
}
};
};
View on GitHub (pinned to fa42722fef)
Solutions
- Identify the unknown table from the logged list and either register its collection or remove the orphan table from the database.
- Enable the plugin that owns the missing collection so it is registered.
- If the table is a leftover, drop it (after backup) so inherited queries no longer return it.
- Re-run `yarn nocobase upgrade` / refresh collections to resync tableNameCollectionMap.
Example fix
// before SELECT * FROM parent_collection; // returns rows from orphan table 'old_child' // after drop legacy table or re-enable its plugin, then re-run the query
Defensive patterns
Strategy: validation
Validate before calling
const known = new Set(db.tableNameCollectionMap.keys());
const orphans = rows.map((r) => `${r.__schemaName}.${r.__tableName}`).filter((t) => !known.has(t));
if (orphans.length) console.warn('Unmapped tables in result:', orphans); Try / catch
try {
const result = await repository.find(options);
} catch (e) {
logger.warn(`inherited find issue: ${e.message}`);
const result = await repository.find({ ...options, filter: {} });
} Prevention
- Drop or re-register orphan tables left behind by disabled plugins.
- Keep inherited-collection children's plugins enabled with the parent.
- Refresh collections (yarn nocobase upgrade) after schema changes.
- Avoid raw SQL joining unknown tables into inherited finds.
When it happens
Trigger: Querying an inherited collection returns rows whose physical table has no registered collection — e.g. the child table exists in the DB but its collection/plugin was removed, or a raw query returns tables outside the current collections.
Common situations: Disabling a plugin whose tables remain in the database; raw SQL joined tables; stale tableNameCollectionMap after collection reload; multi-schema setups where the schema prefix doesn't match.
Related errors
- No permissions
- createdById field not found
- The PDF file is password-protected and cannot be parsed. Ple
- Authenticator [${name}] is not found.
- ${localDir} is not a directory
AI-assisted analysis of nocobase/nocobase@fa42722fef (2026-09-01).
Data as JSON: /api/errors/9bb0e3df3216550f.
Report an issue: GitHub.