{"record":{"id":"adc220f970e3c93b","repo":"siyuan-note/siyuan","slug":"path-is-required-adc220","errorCode":null,"errorMessage":"--path is required","messagePattern":"--path is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/history.go","lineNumber":95,"sourceCode":"\t\tfor _, ts := range timestamps {\n\t\t\titems := model.FullTextSearchHistoryItems(ts, query, box, op, typ)\n\t\t\tfmt.Printf(\"[%s] %d item(s)\\n\", ts, len(items))\n\t\t\tfor _, item := range items {\n\t\t\t\tfmt.Printf(\"  %-8s %s  %s\\n\", item.Op, truncate(item.Title, 60), item.Path)\n\t\t\t}\n\t\t}\n\t\tfmt.Printf(\"\\nPage %d/%d, %d total\\n\", page, pageCount, totalCount)\n\t}\n\treturn nil\n}\n\nvar historyGetCmd = &cobra.Command{\n\tUse:   \"get --path <path>\",\n\tShort: \"Get historical file content\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\thistoryPath, _ := cmd.Flags().GetString(\"path\")\n\t\tif historyPath == \"\" {\n\t\t\treturn fmt.Errorf(\"--path is required\")\n\t\t}\n\n\t\t_, _, content, _, err := model.GetDocHistoryContent(historyPath, \"\", false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Print(content)\n\t\treturn nil\n\t},\n}\n\nvar historyRollbackCmd = &cobra.Command{\n\tUse:   \"rollback --path <path>\",\n\tShort: \"Rollback a document to historical version\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\thistoryPath, _ := cmd.Flags().GetString(\"path\")\n\t\tif historyPath == \"\" {\n\t\t\treturn fmt.Errorf(\"--path is required\")","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/history.go#L77-L113","documentation":"Thrown by the `history get` subcommand when the `--path` flag is empty. The path identifies a specific historical file entry inside the history store; it is passed straight to `model.GetDocHistoryContent`. Without a path the model cannot locate a history snapshot to read.","triggerScenarios":"Running `siyuan history get` with no `--path`. The RunE reads the flag and returns the error before calling `model.GetDocHistoryContent(historyPath, \"\", false)`.","commonSituations":"Forgetting that the history path (not a doc ID) is required; not knowing the history path format; confusing this with `history list` which needs no path.","solutions":["Run `siyuan history list` first to obtain the history entry path","Pass it: `siyuan history get --path <historyPath>`"],"exampleFix":"// before\nsiyuan history get\n// after\nsiyuan history get --path 2024-01/history/20240101120000-abc/edit/20240101130000-abc.sy","handlingStrategy":"validation","validationCode":"if historyPath == \"\" {\n    // list first, then select\n    out, _ := cmd.Output(\"siyuan\", \"history\", \"list\")\n    _ = out\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `history list` to obtain valid paths before `history get`","Note the path points at a history entry, not a doc ID","Copy the exact path from `history list` output to avoid typos"],"tags":["cli","validation","missing-argument","history","go","siyuan"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}