siyuan-note/siyuan · error

CLI does not support encrypted notebook history

Error message

CLI does not support encrypted notebook history

What it means

For `history get` / `history rollback`, the guard resolves the `--path` flag against the workspace dir and passes it to `model.IsEncryptedHistoryPath`; history belonging to an encrypted notebook is unreadable by the CLI, so it aborts with this message.

Source

Thrown at kernel/cli/cmd/root.go:200

	if cmd.Parent() == assetCmd {
		if pathFlag := cmd.Flags().Lookup("path"); pathFlag != nil && pathFlag.Value.String() != "" {
			assetPath := pathFlag.Value.String()
			if !filepath.IsAbs(assetPath) {
				assetPath = filepath.Join("data", assetPath)
			}
			if isEncryptedNotebookWorkspacePath(assetPath) {
				return fmt.Errorf("CLI does not support files in encrypted notebooks")
			}
		}
	}
	if cmd == historyGetCmd || cmd == historyRollbackCmd {
		historyPath, _ := cmd.Flags().GetString("path")
		if historyPath != "" {
			if !filepath.IsAbs(historyPath) {
				historyPath = filepath.Join(util.WorkspaceDir, historyPath)
			}
			if model.IsEncryptedHistoryPath(filepath.Clean(historyPath)) {
				return fmt.Errorf("CLI does not support encrypted notebook history")
			}
		}
	}
	if cmd.Parent() == repoFileCmd {
		fileID, _ := cmd.Flags().GetString("id")
		if fileID != "" {
			boxID, err := model.ResolveRepoFileBoxID(fileID)
			if err != nil {
				return err
			}
			if boxID != "" {
				return fmt.Errorf("CLI does not support encrypted notebook [%s]", boxID)
			}
		}
	}
	return nil
}

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Perform the history get/rollback through the desktop app UI, which can decrypt the history
  2. Choose a history path belonging to a non-encrypted notebook
  3. Decrypt the notebook first, then re-run the CLI history command
Defensive patterns

Strategy: try-catch

Validate before calling

case "$HIST_PATH" in *"$ENC_NOTEBOOK_ID"*) echo "history belongs to encrypted notebook" >&2; exit 1;; esac

Try / catch

if ! out=$(siyuan history get --path "$HIST_PATH" 2>&1); then
  case "$out" in *"encrypted notebook history"*) use_desktop_app_for_history;; *) echo "$out" >&2;; esac
fi

Prevention

When it happens

Trigger: `siyuan history get --path <history path>` (relative or absolute) where the cleaned path is an encrypted notebook's history location under the workspace history dir.

Common situations: Rollback automation over history snapshots in a workspace that includes encrypted notebooks; picking a history path from the desktop UI's encrypted-notebook history list and replaying it via CLI.

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@8641553a1f (2026-09-11). Data as JSON: /api/errors/52cb286abc23eaa0. Report an issue: GitHub.