{"record":{"id":"fd52379a82f10220","repo":"siyuan-note/siyuan","slug":"left-and-right-are-required","errorCode":null,"errorMessage":"--left and --right are required","messagePattern":"--left and --right are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/repo.go","lineNumber":176,"sourceCode":"\t\t\treturn nil\n\t\t}\n\n\t\tmodel.CheckoutRepoDirect(id)\n\t\tmodel.AppendPushReloadFiletreeEntry()\n\t\tmodel.AppendPushReloadUIEntry()\n\t\tfmt.Println(\"ok\")\n\t\treturn nil\n\t},\n}\n\nvar repoDiffCmd = &cobra.Command{\n\tUse:   \"diff --left <id> --right <id>\",\n\tShort: \"Diff two snapshots\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tleft, _ := cmd.Flags().GetString(\"left\")\n\t\tright, _ := cmd.Flags().GetString(\"right\")\n\t\tif left == \"\" || right == \"\" {\n\t\t\treturn fmt.Errorf(\"--left and --right are required\")\n\t\t}\n\t\tdiff, err := model.DiffRepoSnapshots(left, right)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdata, _ := json.MarshalIndent(diff, \"\", \"  \")\n\t\tfmt.Println(string(data))\n\t\treturn nil\n\t},\n}\n\nvar repoSearchCmd = &cobra.Command{\n\tUse:   \"search <keyword>\",\n\tShort: \"Search files in snapshots\",\n\tArgs:  cobra.MinimumNArgs(1),\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tkeyword := args[0]\n\t\tpage, _ := cmd.Flags().GetInt(\"page\")","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/repo.go#L158-L194","documentation":"Returned by the `repo diff` subcommand when either --left or --right (snapshot IDs) is empty. Diffing two snapshots requires both endpoints; the combined `left == \"\" || right == \"\"` check fires before model.DiffRepoSnapshots.","triggerScenarios":"Running `repo diff` with one or both of --left / --right missing or empty.","commonSituations":"Passing only one snapshot ID, mixing up positional vs flag usage, or a script that left one variable blank.","solutions":["Provide both flags: `repo diff --left <id-a> --right <id-b>`.","List snapshots to obtain both valid IDs."],"exampleFix":"# before\nsiyuan repo diff --left 20240601-abc\ngot: --left and --right are required\n# after\nsiyuan repo diff --left 20240601-abc --right 20240602-def","handlingStrategy":"validation","validationCode":"[ -n \"$LEFT\" ] && [ -n \"$RIGHT\" ] || { echo 'repo diff requires --left and --right'; exit 1; }\nsiyuan repo diff --left \"$LEFT\" --right \"$RIGHT\"","typeGuard":"n/a (CLI flag validation)","tryCatchPattern":"n/a","preventionTips":["Diff needs two distinct snapshot IDs; supply both as flags (not positional).","Source both IDs from a snapshot listing to ensure they exist."],"tags":["cli","repo","validation","missing-argument"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}