{"record":{"id":"b9caba660327f340","repo":"lima-vm/lima","slug":"expected-tag","errorCode":null,"errorMessage":"expected tag","messagePattern":"expected tag","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/snapshot.go","lineNumber":79,"sourceCode":"\treturn createCmd\n}\n\nfunc snapshotCreateAction(cmd *cobra.Command, args []string) error {\n\tctx := cmd.Context()\n\tinstName := args[0]\n\n\tinst, err := store.Inspect(ctx, instName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttag, err := cmd.Flags().GetString(\"tag\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif tag == \"\" {\n\t\treturn errors.New(\"expected tag\")\n\t}\n\n\treturn snapshot.Save(ctx, inst, tag)\n}\n\nfunc newSnapshotDeleteCommand() *cobra.Command {\n\tdeleteCmd := &cobra.Command{\n\t\tUse:     \"delete INSTANCE\",\n\t\tAliases: []string{\"del\"},\n\t\tShort:   \"Delete (del) a snapshot\",\n\t\tExample: `  Delete a snapshot:\n  $ limactl snapshot delete default --tag snap1\n`,\n\t\tArgs:              cobra.MinimumNArgs(1),\n\t\tRunE:              snapshotDeleteAction,\n\t\tValidArgsFunction: snapshotBashComplete,\n\t}\n\tdeleteCmd.Flags().String(\"tag\", \"\", \"Name of the snapshot\")","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/snapshot.go#L61-L97","documentation":"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).","triggerScenarios":"Running `limactl snapshot create <instance>` without `--tag <name>`, or with `--tag \"\"`.","commonSituations":"Forgetting the flag in scripts; shell variable holding the tag expanding to empty; mixing up positional args and flags.","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"],"exampleFix":"// before\nlimactl snapshot create myinstance\n// after\nlimactl snapshot create myinstance --tag snapshot-1","handlingStrategy":"validation","validationCode":"[ -n \"$TAG\" ] || { echo 'usage: limactl snapshot create <inst> --tag <name>' >&2; exit 2; }","typeGuard":null,"tryCatchPattern":"limactl snapshot create \"$inst\" --tag \"$TAG\" || { limactl snapshot create --help; exit 1; }","preventionTips":["Always pass --tag explicitly; never rely on defaults","Default tag variables in scripts (TAG=${TAG:-...})","Check --help when upgrading lima versions"],"tags":["snapshot","cli","missing-flag"],"backgroundTag":"missing-required-flag","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}