{"record":{"id":"e65a91fd956e7148","repo":"lima-vm/lima","slug":"unknown-header-s","errorCode":null,"errorMessage":"unknown header: %s","messagePattern":"unknown header: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/snapshot.go","lineNumber":204,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\n\tquiet, err := cmd.Flags().GetBool(\"quiet\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tout, err := snapshot.List(ctx, inst)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif quiet {\n\t\tfor i, line := range strings.Split(out, \"\\n\") {\n\t\t\t// \"ID\", \"TAG\", \"VM SIZE\", \"DATE\", \"VM CLOCK\", \"ICOUNT\"\n\t\t\tfields := strings.Fields(line)\n\t\t\tif i == 0 && len(fields) > 1 && fields[1] != \"TAG\" {\n\t\t\t\t// make sure that output matches the expected\n\t\t\t\treturn fmt.Errorf(\"unknown header: %s\", line)\n\t\t\t}\n\t\t\tif i == 0 || line == \"\" {\n\t\t\t\t// skip header and empty line after using split\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttag := fields[1]\n\t\t\tfmt.Fprintf(cmd.OutOrStdout(), \"%s\\n\", tag)\n\t\t}\n\t\treturn nil\n\t}\n\tfmt.Fprint(cmd.OutOrStdout(), out)\n\treturn nil\n}\n\nfunc snapshotBashComplete(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {\n\treturn bashCompleteInstanceNames(cmd)\n}\n","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/snapshot.go#L186-L222","documentation":"In snapshotListAction with --quiet, limactl parses the snapshot listing line-by-line and validates that the first line's second field is the literal \"TAG\" (expected header: ID TAG VM SIZE DATE VM CLOCK ICOUNT). If the header doesn't match, it returns \"unknown header: <line>\" because the output format can't be trusted for field extraction (tag := fields[1]).","triggerScenarios":"Running `limactl snapshot list --quiet <instance>` when the underlying snapshot tool output changed shape: no snapshots present yielding different output, a non-QEMU driver returning a different listing format, or locale/whitespace changes shifting fields.","commonSituations":"Scripting --quiet output for empty snapshot lists; driver/backend version mismatch changing column order; parsing assumptions broken after lima or QEMU upgrade; custom LIMA_HOME with stale instance state.","solutions":["Run `limactl snapshot list <instance>` without --quiet to inspect the actual raw output","If no snapshots exist, create one first or handle the empty case in your script","Update lima and the guestagent so host/guest snapshot output versions match","Parse the non-quiet output or use `limactl list` fields if you only need instance metadata"],"exampleFix":"// before: blindly parsing --quiet output\ntags=$(limactl snapshot list --quiet \"$inst\" | awk '{print $2}')\n// after: guard for empty/short output\nout=$(limactl snapshot list --quiet \"$inst\" 2>&1) || { echo \"$out\"; exit 1; }\n[ \"$(echo \"$out\" | wc -l)\" -gt 1 ] && tags=$(echo \"$out\" | tail -n +2 | awk '{print $2}')","handlingStrategy":"fallback","validationCode":"out=$(limactl snapshot list \"$inst\" 2>&1) || { echo \"$out\"; exit 1; }\necho \"$out\" | head -n1 | grep -q 'TAG' || { echo 'snapshot listing format unexpected; skipping parse' >&2; exit 0; }","typeGuard":null,"tryCatchPattern":"if ! tags=$(limactl snapshot list --quiet \"$inst\" 2>&1); then\n  echo \"$tags\" >&2; tags=''\nfi","preventionTips":["Handle the empty-snapshot-list case in scripts before parsing","Re-verify parsers after lima or QEMU upgrades","Prefer machine-readable sources (limactl list --json) where possible"],"tags":["snapshot","output-parsing","cli"],"backgroundTag":"unexpected-output-format","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}