{"record":{"id":"a27745ae6c3f4c37","repo":"siyuan-note/siyuan","slug":"name-is-required-a27745","errorCode":null,"errorMessage":"--name is required","messagePattern":"--name is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/repo.go","lineNumber":135,"sourceCode":"\t\t\tfmt.Printf(\"[dry-run] Would tag snapshot %s with \\\"%s\\\"\\n\", id, name)\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := model.TagSnapshot(id, 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 repoUntagCmd = &cobra.Command{\n\tUse:   \"untag --name <name>\",\n\tShort: \"Remove a tag\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tname, _ := cmd.Flags().GetString(\"name\")\n\t\tif name == \"\" {\n\t\t\treturn fmt.Errorf(\"--name is required\")\n\t\t}\n\n\t\tif dryRun {\n\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\",","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/cli/cmd/repo.go#L117-L153","documentation":"Argument validation in the cobra repoUntagCmd RunE: fires when the --name flag is empty. Removing a snapshot tag requires the tag name to pass to model.RemoveTagSnapshot; running `repo untag` without --name is the faulting usage.","triggerScenarios":"Running `siyuan repo untag` without `--name`, or with `--name \"\"`; e.g. `siyuan repo untag` expecting an interactive prompt.","commonSituations":"Assuming the command takes a positional argument instead of a flag; scripts where the tag-name variable is unset; deleting a flag when refactoring a command line.","solutions":["Re-run with: `siyuan repo untag --name <tagName>`","Verify the tag name variable is set in your script","Note that unlike `tag`, this command needs only `--name` (no `--id`)"],"exampleFix":"// before\nsiyuan repo untag v1\n// after\nsiyuan repo untag --name v1","handlingStrategy":"validation","validationCode":"[ -n \"$TAG_NAME\" ] || { echo \"repo untag: missing --name\" >&2; exit 2; }\nsiyuan repo untag --name \"$TAG_NAME\"","typeGuard":"function requireFlag(v) { if (typeof v !== 'string' || v.trim() === '') throw new Error('--name is required'); return v; }","tryCatchPattern":"siyuan repo untag --name \"$TAG_NAME\" || { echo 'pass the tag via --name, not as a positional argument'; }","preventionTips":["Pass the tag as a flag (--name), never as a bare positional argument","Check scripts for unset tag-name variables","Use --dry-run to confirm the command line resolves correctly"],"tags":["cli","missing-flag","snapshot"],"backgroundTag":"missing-required-flag","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"}