{"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":"validation","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/9f775e8a12daef8255556097396f9b2739078892/kernel/cli/cmd/root.go#L182-L218","documentation":"`history get` and `history rollback` accept a --path pointing at history files; the CLI cleans the path (resolving relative paths against util.WorkspaceDir) and checks model.IsEncryptedHistoryPath. History belonging to encrypted notebooks is outside the CLI's scope — it can only be accessed through the in-app unlock flow — so the command aborts.","triggerScenarios":"Running `SiYuan-Kernel history get` or `history rollback` with --path resolving to a history path of an encrypted notebook (e.g. under the workspace's history directory for an encrypted box), whether passed as a relative or absolute path.","commonSituations":"Rollback scripts iterating history entries without distinguishing encrypted notebooks; restoring an older snapshot whose source notebook was encrypted; pointing history rollback at a history directory by hand.","solutions":["Restore history for that notebook via the SiYuan app's history UI instead of the CLI.","Check the --path value; only use history paths of non-encrypted notebooks.","Exclude encrypted-notebook history entries from automation that drives history rollback."],"exampleFix":"// before\nSiYuan-Kernel history rollback --path \"history/20240101120000-enc1/...\"\n// after: use the in-app history panel, or target a plain notebook\nSiYuan-Kernel history rollback --path \"history/20240101120000-plain/...\"","handlingStrategy":"validation","validationCode":"// Go: pre-check history paths against the encrypted-history matcher\nif model.IsEncryptedHistoryPath(filepath.Clean(p)) { return skip }","typeGuard":null,"tryCatchPattern":"if err := runKernelCLI(args); err != nil && strings.Contains(err.Error(), \"encrypted notebook history\") {\n    // perform the rollback in the app's history panel instead\n}","preventionTips":["Filter history entries by owning notebook before feeding paths to history get/rollback.","Never hand-craft history paths; list them via the app or tooling that marks encrypted notebooks.","Use the in-app history UI for any rollback touching encrypted notebooks."],"tags":["cli","encryption","history"],"backgroundTag":"unsupported-operation","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}