siyuan-note/siyuan · error

idData.msg

Error message

idData.msg

What it means

When resolveMissingPosition is enabled, getCancelSBOperations calls /api/block/getBlockSiblingID to determine the previous/parent ids for re-inserting a superblock. A non-zero response code causes the kernel's `idData.msg` to be thrown, since the sibling lookup is required to build the cancel operation.

Solutions

  1. Confirm the block id and notebookID are current (refresh the document before the operation)
  2. Rebuild the index if sibling lookups fail consistently
  3. Check kernel logs for the error detail returned in msg
  4. Retry the operation after the document reloads
Defensive patterns

Strategy: try-catch

Type guard

const hasSiblingData = (d: any): d is {data: {previous: string; parent: string}} => !!d?.data && "previous" in d.data && "parent" in d.data;

Try / catch

try {
    await operationData(options);
} catch (e) {
    showMessage(e.message); // sibling lookup failed; refresh the document before retrying
}

Prevention

When it happens

Trigger: getBlockSiblingID is called for a block id the kernel cannot resolve — deleted block, wrong notebook parameter, or kernel index inconsistency preventing sibling lookup.

Common situations: Undo/cancel operations referencing blocks removed by a concurrent edit or sync; index corruption after a crash; passing a notebookID that does not match the block.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/0f3d22d61162f9ec. Report an issue: GitHub.

Appendix: source

Thrown at app/src/block/util.ts:86

        folded: item.getAttribute("data-type") === "NodeHeading" && item.getAttribute("fold") === "1",
    })), options.excludedChildIDs, options.childReplacements);
    const sbElement = nodeElement.cloneNode() as HTMLElement;
    sbElement.innerHTML = nodeElement.lastElementChild.outerHTML;
    let previousId = options.previousID;
    if (typeof previousId !== "string") {
        previousId = getPreviousBlockSibling(nodeElement)?.getAttribute("data-node-id");
    }
    let parentID = options.parentID || getEmbedChildOperationParentID(nodeElement) ||
        getParentBlock(nodeElement)?.getAttribute("data-node-id");
    // 缩放和反链需要接口获取
    if (!previousId && !parentID) {
        if (options.resolveMissingPosition) {
            const idData = await fetchSyncPost("/api/block/getBlockSiblingID", {
                id,
                notebook: options.notebookID,
            });
            if (idData.code !== 0) {
                throw new Error(idData.msg);
            }
            previousId = idData.data.previous;
            parentID = idData.data.parent;
        } else {
            parentID = options.fallbackParentID;
        }
    }
    const operationData = buildCancelSuperBlockOperations({
        id,
        data: sbElement.outerHTML,
        childIDs,
        foldedHeadingIDs,
        previousID: previousId,
        parentID,
    });
    const focusId = visibleChildElements[visibleChildElements.length - 1]?.getAttribute("data-node-id") || previousId;
    return {
        ...operationData,

View on GitHub (pinned to 9f775e8a12)