toeverything/AFFiNE · error · Error

Node not found

Error message

Node not found

What it means

A lookup guard in renameNode: it fetches nodeId from the folders table and throws when get returns null. It fires when a rename is requested for a node id that does not exist in the organize tree — stale reference or already-deleted node; the faulting input is the nodeId argument.

Source

Thrown at packages/frontend/core/src/modules/organize/stores/folder.ts:69

    index: string
  ) {
    const parent = this.dbService.db.folders.get(parentId);
    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({

View on GitHub (pinned to b4c8548c09)

Solutions

  1. The node may have been deleted; refresh the organize tree.
  2. Verify the node id before the operation.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown when renameNode or moveNode is called with a nodeId that has no record in the folders DB.

Common situations: Triggered by renaming or moving an organize-tree entry that no longer exists, often due to stale UI state after deletion. Refresh the sidebar tree and retry.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/62cb2318fcc6f2ed. Report an issue: GitHub.