siyuan-note/siyuan · error
--old is required
Error message
--old is required
What it means
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.
Source
Thrown at kernel/cli/cmd/tag.go:82
return nil
}
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
},
}
View on GitHub (pinned to 251596fc0d)
Solutions
- Supply both flags: `siyuan tag rename --old <oldLabel> --new <newLabel>`.
- Confirm the exact old label with `siyuan tag list` first.
Example fix
// before siyuan tag rename --new "reading" // after siyuan tag rename --old "read" --new "reading"
Defensive patterns
Strategy: validation
Validate before calling
if oldLabel == "" {
return errors.New("--old is required: pass the current tag label")
}
// siyuan tag rename --old <old> --new <new> Prevention
- Always pass both `--old` and `--new` together.
- Confirm the old label via `tag list` first.
When it happens
Trigger: Running `siyuan tag rename` with `--new <x>` but no `--old`, or `--old ""`.
Common situations: Forgetting the source label; passing the new label first and omitting the old; scripting rename with an unset `$OLD` variable.
Related errors
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/ad2b8ea315abfc46.
Report an issue: GitHub.