{"record":{"id":"7031f20f1ed91cee","repo":"siyuan-note/siyuan","slug":"id-is-required-7031f2","errorCode":null,"errorMessage":"--id is required","messagePattern":"--id is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/repo.go","lineNumber":153,"sourceCode":"\t\t\tfmt.Printf(\"[dry-run] Would remove snapshot tag \\\"%s\\\"\\n\", name)\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := model.RemoveTagSnapshot(name); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(\"ok\")\n\t\treturn nil\n\t},\n}\n\nvar repoCheckoutCmd = &cobra.Command{\n\tUse:   \"checkout --id <id>\",\n\tShort: \"Checkout (rollback to) a snapshot\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tid, _ := cmd.Flags().GetString(\"id\")\n\t\tif id == \"\" {\n\t\t\treturn fmt.Errorf(\"--id is required\")\n\t\t}\n\n\t\tif dryRun {\n\t\t\tfmt.Printf(\"[dry-run] Would rollback workspace to snapshot %s\\n\", id)\n\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\",","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/repo.go#L135-L171","documentation":"Returned by the `repo checkout` subcommand (rollback to a snapshot) when --id is empty. Rolling back the workspace requires a target snapshot identifier.","triggerScenarios":"Running `repo checkout` with no --id flag or `--id \"\"`. The check fires before the dry-run and model.CheckoutRepoDirectDirect call.","commonSituations":"Omitting the flag, or a script that did not resolve the snapshot ID. Note checkout is a destructive rollback, so always confirm the snapshot ID.","solutions":["Pass a valid snapshot ID: `repo checkout --id <snapshot-id>`.","Use --dry-run to preview the rollback before committing to it.","List snapshots first to obtain the correct ID."],"exampleFix":"# before\nsiyuan repo checkout\n# after\nsiyuan repo checkout --dry-run --id 20240601-abc\n# then, once confirmed:\nsiyuan repo checkout --id 20240601-abc","handlingStrategy":"validation","validationCode":"[ -n \"$SNAP_ID\" ] || { echo 'repo checkout requires --id'; exit 1; }\n# preview first\nsiyuan repo checkout --dry-run --id \"$SNAP_ID\"\n# then roll back\nsiyuan repo checkout --id \"$SNAP_ID\"","typeGuard":"n/a (CLI flag validation)","tryCatchPattern":"n/a (checkout is a destructive rollback; always dry-run first)","preventionTips":["Checkout rolls the workspace back to a snapshot — always run with --dry-run first.","Confirm the snapshot ID from the repo snapshot listing to avoid rolling back to the wrong point."],"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"}