toeverything/AFFiNE · error · Error
Cannot rename non-folder node
Error message
Cannot rename non-folder node
What it means
A type guard in renameNode: the node exists, but renaming by updating the node's data is only meaningful for folders (links mirror their target's name). It fires when nodeId resolves to a doc/tag/collection link rather than a folder — the caller must rename the underlying entity instead of the link node.
Source
Thrown at packages/frontend/core/src/modules/organize/stores/folder.ts:72
if (parent === null || parent.type !== 'folder') {
throw new Error('Parent folder not found');
}
this.dbService.db.folders.create({
parentId,
type,
data: nodeId,
index: index,
});
}
renameNode(nodeId: string, name: string) {
const node = this.dbService.db.folders.get(nodeId);
if (node === null) {
throw new Error('Node not found');
}
if (node.type !== 'folder') {
throw new Error('Cannot rename non-folder node');
}
this.dbService.db.folders.update(nodeId, {
data: name,
});
}
createFolder(parentId: string | null, name: string, index: string) {
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,View on GitHub (pinned to b4c8548c09)
Solutions
- Only rename folder nodes; use the appropriate operation for docs/links.
- Check the node type before renaming.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown by renameNode when the target node exists but its type is not folder, since only folder nodes store a renamable name in data.
Common situations: A rename was attempted on a doc, tag, or collection link in the organize tree instead of a folder. Rename the underlying doc or tag from its own UI instead.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/7925c0b5b4255a86.
Report an issue: GitHub.