toeverything/AFFiNE · error · Error
Folder not found
Error message
Folder not found
What it means
A lookup/type guard in removeFolder: it fetches folderId from the folders table and requires the record to exist with type 'folder'. It fires when a folder deletion is requested for an id that is missing or points at a link node — the faulting input is the folderId argument; recursive stack-based deletion is only defined for folders.
Source
Thrown at packages/frontend/core/src/modules/organize/stores/folder.ts:98
if (parentId) {
const parent = this.dbService.db.folders.get(parentId);
if (parent === null || parent.type !== 'folder') {
throw new Error('Parent folder not found');
}
}
return this.dbService.db.folders.create({
parentId: parentId,
type: 'folder',
data: name,
index: index,
}).id;
}
removeFolder(folderId: string) {
const info = this.dbService.db.folders.get(folderId);
if (info === null || info.type !== 'folder') {
throw new Error('Folder not found');
}
const stack = [info];
while (stack.length > 0) {
const current = stack.pop();
if (!current) {
continue;
}
if (current.type !== 'folder') {
this.dbService.db.folders.delete(current.id);
} else {
const children = this.dbService.db.folders.find({
parentId: current.id,
});
stack.push(...children);
this.dbService.db.folders.delete(current.id);
}
}
}View on GitHub (pinned to b4c8548c09)
Solutions
- Verify the folder id; it may have been deleted.
- Refresh the folder tree and retry.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown by removeFolder when the folderId has no record in the folders DB or the record is not of type folder.
Common situations: Occurs when deleting a folder that was already removed or is actually a link node. Refresh the organize tree and retry the deletion.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/a5e32667f4a2e1b3.
Report an issue: GitHub.