{"record":{"id":"271c8bf0d5379376","repo":"siyuan-note/siyuan","slug":"id-and-name-are-required","errorCode":null,"errorMessage":"--id and --name are required","messagePattern":"--id and --name are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/repo.go","lineNumber":113,"sourceCode":"\t\t\treturn err\n\t\t}\n\t\tif created {\n\t\t\tfmt.Println(\"created snapshot\", id)\n\t\t} else {\n\t\t\tfmt.Println(\"no changes; existing snapshot\", id)\n\t\t}\n\t\treturn nil\n\t},\n}\n\nvar repoTagCmd = &cobra.Command{\n\tUse:   \"tag --id <id> --name <name>\",\n\tShort: \"Tag a snapshot\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tid, _ := cmd.Flags().GetString(\"id\")\n\t\tname, _ := cmd.Flags().GetString(\"name\")\n\t\tif id == \"\" || name == \"\" {\n\t\t\treturn fmt.Errorf(\"--id and --name are required\")\n\t\t}\n\n\t\tif dryRun {\n\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\",","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/cli/cmd/repo.go#L95-L131","documentation":"The `siyuan repo tag` command tags a repo snapshot and requires both `--id` (snapshot ID) and `--name` (tag name). The RunE handler returns this error when either flag is empty, before dry-run handling or the tagging call.","triggerScenarios":"Running `siyuan repo tag` missing `--id`, missing `--name`, or both; e.g. `siyuan repo tag --id <snapshotID>` without `--name v1`.","commonSituations":"Assuming the tag alone identifies the snapshot (both are required); scripts that only fill one variable; typos in flag names silently yielding empty values.","solutions":["Re-run with both flags: `siyuan repo tag --id <snapshotID> --name <tagName>`","Echo the variables in your script to confirm both snapshot ID and tag name are set","List available snapshots first to obtain a valid --id"],"exampleFix":"// before\nsiyuan repo tag --id 20240101120000-abcdefg\n// after\nsiyuan repo tag --id 20240101120000-abcdefg --name v1","handlingStrategy":"validation","validationCode":"[ -n \"$SNAP_ID\" ] && [ -n \"$TAG_NAME\" ] || { echo \"repo tag: need --id and --name\" >&2; exit 2; }\nsiyuan repo tag --id \"$SNAP_ID\" --name \"$TAG_NAME\"","typeGuard":"function requireBoth(a, b, names) { if (!a || !b) throw new Error(names.join(' and ') + ' are required'); }","tryCatchPattern":"siyuan repo tag --id \"$SNAP_ID\" --name \"$TAG_NAME\" || { echo 'verify both --id and --name were provided'; }","preventionTips":["Remember tag needs BOTH --id and --name, while untag needs only --name","Echo variables in scripts to confirm both values are set","Quote flag values to avoid empty expansion"],"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"}