lima-vm/lima · error
expected tag
Error message
expected tag
What it means
snapshotCreateAction requires a non-empty --tag flag naming the snapshot to create; when --tag is missing or empty it returns "expected tag" before calling snapshot.Save. The tag is the identifier passed to the guest's snapshot management (qemu-style snapshot naming).
Source
Thrown at cmd/limactl/snapshot.go:79
return createCmd
}
func snapshotCreateAction(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
instName := args[0]
inst, err := store.Inspect(ctx, instName)
if err != nil {
return err
}
tag, err := cmd.Flags().GetString("tag")
if err != nil {
return err
}
if tag == "" {
return errors.New("expected tag")
}
return snapshot.Save(ctx, inst, tag)
}
func newSnapshotDeleteCommand() *cobra.Command {
deleteCmd := &cobra.Command{
Use: "delete INSTANCE",
Aliases: []string{"del"},
Short: "Delete (del) a snapshot",
Example: ` Delete a snapshot:
$ limactl snapshot delete default --tag snap1
`,
Args: cobra.MinimumNArgs(1),
RunE: snapshotDeleteAction,
ValidArgsFunction: snapshotBashComplete,
}
deleteCmd.Flags().String("tag", "", "Name of the snapshot")View on GitHub (pinned to dd909d0973)
Solutions
- Pass a tag: `limactl snapshot create <instance> --tag my-snap`
- In scripts, default the variable: TAG=${TAG:-snap-$(date +%s)}
- Run `limactl snapshot create --help` to confirm flag names
Example fix
// before limactl snapshot create myinstance // after limactl snapshot create myinstance --tag snapshot-1
Defensive patterns
Strategy: validation
Validate before calling
[ -n "$TAG" ] || { echo 'usage: limactl snapshot create <inst> --tag <name>' >&2; exit 2; } Try / catch
limactl snapshot create "$inst" --tag "$TAG" || { limactl snapshot create --help; exit 1; } Prevention
- Always pass --tag explicitly; never rely on defaults
- Default tag variables in scripts (TAG=${TAG:-...})
- Check --help when upgrading lima versions
When it happens
Trigger: Running `limactl snapshot create <instance>` without `--tag <name>`, or with `--tag ""`.
Common situations: Forgetting the flag in scripts; shell variable holding the tag expanding to empty; mixing up positional args and flags.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- network mode %#q requires specifying gateway
- unknown header: %s
- instance %q not found
- disk format %#q not supported, use `qcow2` or `raw` instead
- failed to check if the autostart entry for instance %#q is r
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/b9caba660327f340.
Report an issue: GitHub.