siyuan-note/siyuan · error
--id and --name are required
Error message
--id and --name are required
What it means
Returned by the `repo tag` subcommand when either --id (snapshot ID) or --name (tag label) is empty. Tagging a snapshot requires both a target and a label.
Source
Thrown at kernel/cli/cmd/repo.go:109
}
id, err := model.IndexRepo(memo)
if err != nil {
return err
}
fmt.Println("created snapshot", id)
return nil
},
}
var repoTagCmd = &cobra.Command{
Use: "tag --id <id> --name <name>",
Short: "Tag a snapshot",
RunE: func(cmd *cobra.Command, args []string) error {
id, _ := cmd.Flags().GetString("id")
name, _ := cmd.Flags().GetString("name")
if id == "" || name == "" {
return fmt.Errorf("--id and --name are required")
}
if dryRun {
fmt.Printf("[dry-run] Would tag snapshot %s with \"%s\"\n", id, name)
return nil
}
if err := model.TagSnapshot(id, name); err != nil {
return err
}
fmt.Println("ok")
return nil
},
}
var repoUntagCmd = &cobra.Command{
Use: "untag --name <name>",
Short: "Remove a tag",View on GitHub (pinned to 251596fc0d)
Solutions
- Provide both flags: `repo tag --id <snapshot-id> --name <tag>`.
- List snapshots first to obtain a valid snapshot ID.
Example fix
# before siyuan repo tag --id 20240601-abc got: --id and --name are required # after siyuan repo tag --id 20240601-abc --name release-1.0
Defensive patterns
Strategy: validation
Validate before calling
[ -n "$SNAP_ID" ] && [ -n "$TAG" ] || { echo 'repo tag requires --id and --name'; exit 1; }
siyuan repo tag --id "$SNAP_ID" --name "$TAG" Type guard
n/a (CLI flag validation)
Try / catch
n/a
Prevention
- Tagging needs both a snapshot ID and a label; supply both in wrappers.
- List snapshots to obtain a valid --id before tagging.
When it happens
Trigger: Running `repo tag` missing one or both of --id / --name; the combined `id == "" || name == ""` check fires before model.TagSnapshot.
Common situations: Passing only the snapshot id, only the name, or a script that left one variable empty.
Related errors
- --name is required
- --id is required
- --left and --right are required
- --pattern is required
- --path is required
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/271c8bf0d5379376.
Report an issue: GitHub.