{"record":{"id":"52cb286abc23eaa0","repo":"siyuan-note/siyuan","slug":"cli-does-not-support-encrypted-notebook-history","errorCode":null,"errorMessage":"CLI does not support encrypted notebook history","messagePattern":"CLI does not support encrypted notebook history","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/root.go","lineNumber":200,"sourceCode":"\tif cmd.Parent() == assetCmd {\n\t\tif pathFlag := cmd.Flags().Lookup(\"path\"); pathFlag != nil && pathFlag.Value.String() != \"\" {\n\t\t\tassetPath := pathFlag.Value.String()\n\t\t\tif !filepath.IsAbs(assetPath) {\n\t\t\t\tassetPath = filepath.Join(\"data\", assetPath)\n\t\t\t}\n\t\t\tif isEncryptedNotebookWorkspacePath(assetPath) {\n\t\t\t\treturn fmt.Errorf(\"CLI does not support files in encrypted notebooks\")\n\t\t\t}\n\t\t}\n\t}\n\tif cmd == historyGetCmd || cmd == historyRollbackCmd {\n\t\thistoryPath, _ := cmd.Flags().GetString(\"path\")\n\t\tif historyPath != \"\" {\n\t\t\tif !filepath.IsAbs(historyPath) {\n\t\t\t\thistoryPath = filepath.Join(util.WorkspaceDir, historyPath)\n\t\t\t}\n\t\t\tif model.IsEncryptedHistoryPath(filepath.Clean(historyPath)) {\n\t\t\t\treturn fmt.Errorf(\"CLI does not support encrypted notebook history\")\n\t\t\t}\n\t\t}\n\t}\n\tif cmd.Parent() == repoFileCmd {\n\t\tfileID, _ := cmd.Flags().GetString(\"id\")\n\t\tif fileID != \"\" {\n\t\t\tboxID, err := model.ResolveRepoFileBoxID(fileID)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif boxID != \"\" {\n\t\t\t\treturn fmt.Errorf(\"CLI does not support encrypted notebook [%s]\", boxID)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/cli/cmd/root.go#L182-L218","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Perform the history get/rollback through the desktop app UI, which can decrypt the history","Choose a history path belonging to a non-encrypted notebook","Decrypt the notebook first, then re-run the CLI history command"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"case \"$HIST_PATH\" in *\"$ENC_NOTEBOOK_ID\"*) echo \"history belongs to encrypted notebook\" >&2; exit 1;; esac","typeGuard":null,"tryCatchPattern":"if ! out=$(siyuan history get --path \"$HIST_PATH\" 2>&1); then\n  case \"$out\" in *\"encrypted notebook history\"*) use_desktop_app_for_history;; *) echo \"$out\" >&2;; esac\nfi","preventionTips":["Roll back or inspect encrypted-notebook history only via the desktop app","Filter history listings by notebook and skip encrypted ones before scripting CLI calls","Pass absolute history paths and validate them against encrypted history prefixes first"],"tags":["cli","encryption","history","flag-value"],"backgroundTag":"unsupported-operation","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}