{"record":{"id":"ad2b8ea315abfc46","repo":"siyuan-note/siyuan","slug":"old-is-required-ad2b8e","errorCode":null,"errorMessage":"--old is required","messagePattern":"--old is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/tag.go","lineNumber":82,"sourceCode":"\t\t\treturn nil\n\t\t}\n\n\t\tif err := model.RemoveTag(label); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmodel.AppendPushReloadTagEntry()\n\t\treturn nil\n\t},\n}\n\nvar tagRenameCmd = &cobra.Command{\n\tUse:   \"rename --old <old-label> --new <new-label>\",\n\tShort: \"Rename a tag\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\toldLabel, _ := cmd.Flags().GetString(\"old\")\n\t\tnewLabel, _ := cmd.Flags().GetString(\"new\")\n\t\tif oldLabel == \"\" {\n\t\t\treturn fmt.Errorf(\"--old is required\")\n\t\t}\n\t\tif newLabel == \"\" {\n\t\t\treturn fmt.Errorf(\"--new is required\")\n\t\t}\n\n\t\tif dryRun {\n\t\t\tfmt.Printf(\"[dry-run] Would rename tag \\\"%s\\\" to \\\"%s\\\"\\n\", oldLabel, newLabel)\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := model.RenameTag(oldLabel, newLabel); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmodel.AppendPushReloadTagEntry()\n\t\treturn nil\n\t},\n}\n","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/tag.go#L64-L100","documentation":"Thrown by the `tag rename` cobra subcommand when `--old` is empty. `--old` is the current label text to rename away from, passed to `model.RenameTag(oldLabel, newLabel)`. The check runs before `--new` validation and before `--dry-run`. An empty old label would make the rename target ambiguous, so it is rejected up front.","triggerScenarios":"Running `siyuan tag rename` with `--new <x>` but no `--old`, or `--old \"\"`.","commonSituations":"Forgetting the source label; passing the new label first and omitting the old; scripting rename with an unset `$OLD` variable.","solutions":["Supply both flags: `siyuan tag rename --old <oldLabel> --new <newLabel>`.","Confirm the exact old label with `siyuan tag list` first."],"exampleFix":"// before\nsiyuan tag rename --new \"reading\"\n// after\nsiyuan tag rename --old \"read\" --new \"reading\"","handlingStrategy":"validation","validationCode":"if oldLabel == \"\" {\n    return errors.New(\"--old is required: pass the current tag label\")\n}\n// siyuan tag rename --old <old> --new <new>","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass both `--old` and `--new` together.","Confirm the old label via `tag list` first."],"tags":["cli","validation","tag","argument-required"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}