toeverything/AFFiNE · error · Error
Table not found
Error message
Table not found
What it means
A lookup guard in YjsDBAdapter.table: the adapter only pre-registers table adapters for schemas declared in the DBSchemaBuilder at construction time, so this fires when tableName has no entry in the tables Map — i.e. code asked for a table that was never defined in the schema. The faulting input is the tableName string passed to table().
Source
Thrown at packages/common/infra/src/orm/core/adapters/yjs/db.ts:30
export class YjsDBAdapter implements DBAdapter {
tables: Map<string, TableAdapter> = new Map();
constructor(
db: DBSchemaBuilder,
private readonly provider: DocProvider
) {
for (const [tableName, table] of Object.entries(db)) {
validators.validateYjsTableSchema(tableName, table);
const doc = this.provider.getDoc(tableName);
this.tables.set(tableName, new YjsTableAdapter(tableName, doc));
}
}
table(tableName: string) {
const table = this.tables.get(tableName);
if (!table) {
throw new Error('Table not found');
}
return table;
}
}
View on GitHub (pinned to b4c8548c09)
Solutions
- Create the table in the Yjs document before reading or writing records.
- Verify the table name matches the one used at creation time.
- Ensure the doc is synced/initialized so its tables are materialized.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at packages/common/infra/src/orm/core/adapters/yjs/db.ts:30 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/7654805aeccda165.
Report an issue: GitHub.