siyuan-note/siyuan · error
--new is required
Error message
--new is required
What it means
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`.
Source
Thrown at kernel/cli/cmd/tag.go:85
if err := model.RemoveTag(label); err != nil {
return err
}
model.AppendPushReloadTagEntry()
return nil
},
}
var tagRenameCmd = &cobra.Command{
Use: "rename --old <old-label> --new <new-label>",
Short: "Rename a tag",
RunE: func(cmd *cobra.Command, args []string) error {
oldLabel, _ := cmd.Flags().GetString("old")
newLabel, _ := cmd.Flags().GetString("new")
if oldLabel == "" {
return fmt.Errorf("--old is required")
}
if newLabel == "" {
return fmt.Errorf("--new is required")
}
if dryRun {
fmt.Printf("[dry-run] Would rename tag \"%s\" to \"%s\"\n", oldLabel, newLabel)
return nil
}
if err := model.RenameTag(oldLabel, newLabel); err != nil {
return err
}
model.AppendPushReloadTagEntry()
return nil
},
}
func printTagTable(tags []string) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintln(w, "LABEL")View on GitHub (pinned to 251596fc0d)
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.
Example fix
// before siyuan tag rename --old "read" // after siyuan tag rename --old "read" --new "reading"
Defensive patterns
Strategy: validation
Validate before calling
if newLabel == "" {
return errors.New("--new is required: pass a non-empty new tag label")
}
// siyuan tag rename --old <old> --new <new> Prevention
- Provide a non-empty destination label.
- If the goal is deletion, use `tag remove` instead of renaming to empty.
When it happens
Trigger: Running `siyuan tag rename --old <x>` with no `--new`, or `--new ""`.
Common situations: Forgetting the destination label; intending to delete (use `tag remove` instead) rather than rename; passing an empty shell variable for the new name.
Related errors
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/2bae2cfdf95cc7c2.
Report an issue: GitHub.