{"record":{"id":"2bae2cfdf95cc7c2","repo":"siyuan-note/siyuan","slug":"new-is-required-2bae2c","errorCode":null,"errorMessage":"--new is required","messagePattern":"--new is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/tag.go","lineNumber":85,"sourceCode":"\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\nfunc printTagTable(tags []string) {\n\tw := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)\n\tfmt.Fprintln(w, \"LABEL\")","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/tag.go#L67-L103","documentation":"Thrown by the `tag rename` cobra subcommand when `--new` is empty (after `--old` has already passed). `--new` is the target label text. The guard prevents renaming a tag to an empty string, which would corrupt the tag index. It runs after the `--old` check and before `--dry-run`.","triggerScenarios":"Running `siyuan tag rename --old <x>` with no `--new`, or `--new \"\"`.","commonSituations":"Forgetting the destination label; intending to delete (use `tag remove` instead) rather than rename; passing an empty shell variable for the new name.","solutions":["Provide a non-empty new label: `siyuan tag rename --old <old> --new <new>`.","If you meant to delete the tag, use `siyuan tag remove --label <old>` instead."],"exampleFix":"// before\nsiyuan tag rename --old \"read\"\n// after\nsiyuan tag rename --old \"read\" --new \"reading\"","handlingStrategy":"validation","validationCode":"if newLabel == \"\" {\n    return errors.New(\"--new is required: pass a non-empty new tag label\")\n}\n// siyuan tag rename --old <old> --new <new>","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provide a non-empty destination label.","If the goal is deletion, use `tag remove` instead of renaming to empty."],"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"}