siyuan-note/siyuan · error

document block [ ] cannot be moved with block move; use…

Error message

document block [%s] cannot be moved with block move; use document move instead

What it means

The SiYuan CLI's block move command validates that the target ID is not a document block. Document blocks ('d' type in the block tree) cannot be re-parented via the generic block-move path; they have a dedicated document move command. This error is raised in validateBlockMove (kernel/cli/cmd/block.go:456) before any mutation occurs.

Solutions

  1. Identify the document by its ID and use the document move command instead of the block move command
  2. If the intent was to move a block within a document, resolve the actual inner block ID (not the doc/root ID) and retry
  3. Check bt.Type via block info (`batch-get` or the API /api/block/getBlockInfo) before moving to confirm the target is not type 'd'

Example fix

// before
siyuan block move --id 20240101120000-abcdefg --parent 20240101120000-parent1
// after (id is a document)
siyuan doc move --id 20240101120000-abcdefg --parent 20240101120000-parent1
Defensive patterns

Strategy: validation

Validate before calling

info=$(siyuan block batch-get --ids "$ID")
type=$(echo "$info" | jq -r '.[0].type // empty')
if [ "$type" = "d" ]; then
  siyuan doc move --id "$ID" --parent "$PARENT"
else
  siyuan block move --id "$ID" --parent "$PARENT"
fi

Type guard

function isDocumentBlock(info) { return info && info.type === 'd'; }

Prevention

When it happens

Trigger: Running a block move command (e.g. `siyuan block move --id <id> --parent <pid>`) where --id resolves to a document block. treenode.GetBlockTree(id) returns a block tree node whose Type is "d".

Common situations: Scripting bulk reorganization and passing a doc ID collected from a search or export instead of a child block ID; confusing the document ID (rootID) with an inner block ID; using the block move command on a top-level item clicked in the doc tree.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at kernel/cli/cmd/block.go:456

		}
		if err := model.PerformTxSync(transaction); err != nil {
			return err
		}
		if bt := treenode.GetBlockTree(id); bt != nil {
			model.AppendPushReloadProtyleEntry(bt.RootID)
		}
		fmt.Println("ok")
		return nil
	},
}

func validateBlockMove(id, parentID, previousID string) error {
	bt := treenode.GetBlockTree(id)
	if nil == bt {
		return fmt.Errorf("block not found: %s", id)
	}
	if "d" == bt.Type {
		return fmt.Errorf("document block [%s] cannot be moved with block move; use document move instead", id)
	}

	if "" != previousID {
		previousBt := treenode.GetBlockTree(previousID)
		if nil == previousBt {
			return fmt.Errorf("previous block not found: %s", previousID)
		}
		if "d" == previousBt.Type {
			return fmt.Errorf("document block [%s] cannot be used as a previous sibling; use it as --parent instead", previousID)
		}
		return nil
	}
	if err := treenode.CheckListItemNesting(parentID, id); err != nil {
		return err
	}
	return treenode.CheckContainerParent(parentID)
}

View on GitHub (pinned to 9f775e8a12)