{"record":{"id":"35e25381edfacdcb","repo":"abiosoft/colima","slug":"error-decoding-limactl-info-json-w","errorCode":null,"errorMessage":"error decoding 'limactl info' json: %w","messagePattern":"error decoding 'limactl info' json: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/core.go","lineNumber":59,"sourceCode":"\n\treturn install()\n}\n\n// LimaVersionSupported checks if the currently installed Lima version is supported.\nfunc LimaVersionSupported() error {\n\tvar values struct {\n\t\tVersion string `json:\"version\"`\n\t}\n\tvar buf bytes.Buffer\n\tcmd := cli.Command(\"limactl\", \"info\")\n\tcmd.Stdout = &buf\n\n\tif err := cmd.Run(); err != nil {\n\t\treturn fmt.Errorf(\"error checking Lima version: %w\", err)\n\t}\n\n\tif err := json.NewDecoder(&buf).Decode(&values); err != nil {\n\t\treturn fmt.Errorf(\"error decoding 'limactl info' json: %w\", err)\n\t}\n\t// remove pre-release hyphen\n\tparts := strings.SplitN(values.Version, \"-\", 2)\n\tif len(parts) > 0 {\n\t\tvalues.Version = parts[0]\n\t}\n\n\tif parts[0] == \"HEAD\" {\n\t\tlogrus.Warnf(\"to avoid compatibility issues, ensure lima development version (%s) in use is not lower than %s\", values.Version, limaVersion)\n\t\treturn nil\n\t}\n\n\tmin := semver.New(strings.TrimPrefix(limaVersion, \"v\"))\n\tcurrent, err := semver.NewVersion(strings.TrimPrefix(values.Version, \"v\"))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid semver version for Lima: %w\", err)\n\t}\n","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/core/core.go#L41-L77","documentation":"After 'limactl info' succeeds, LimaVersionSupported decodes the captured stdout as JSON into a struct with a version field. If stdout is not valid JSON, json.Decoder.Decode fails and is wrapped as 'error decoding limactl info json'. This means limactl ran but emitted something other than the expected JSON document.","triggerScenarios":"A Lima build whose 'limactl info' prints help/usage text instead of JSON (very old or distro-patched limactl without the info subcommand), warnings injected into stdout, or a shim/wrapper earlier in PATH rewriting limactl output.","commonSituations":"Linux distro packages of Lima differing from upstream; version managers or wrappers shimming limactl; untested Lima forks; shell PATH hooks appending text to command output.","solutions":["Run 'limactl info' manually and confirm it prints pure JSON containing a version key","Upgrade Lima to at least v0.18.0, the minimum colima supports: brew upgrade lima","Remove any shim or wrapper around limactl from PATH","If warnings precede the JSON, resolve the underlying Lima warning so stdout stays clean"],"exampleFix":"# before (distro limactl prints usage text)\ncolima start   # error decoding 'limactl info' json\n\n# after\nbrew uninstall lima && brew install lima && colima start","handlingStrategy":"validation","validationCode":"out, err := exec.Command(\"limactl\", \"info\").Output()\nif err != nil { /* covered by error 97 */ }\nif !json.Valid(bytes.TrimSpace(out)) {\n    // limactl is not emitting JSON: upgrade to upstream lima >= v0.18.0\n}","typeGuard":null,"tryCatchPattern":"if err := core.LimaVersionSupported(); err != nil {\n    if strings.Contains(err.Error(), \"error decoding\") {\n        // stdout was not JSON: inspect 'limactl info' output and remove shims\n    }\n}","preventionTips":["Use upstream Lima releases; avoid distro forks for colima compatibility","Do not shim or wrap limactl in PATH with tools that prepend output","After any Lima upgrade, confirm 'limactl info' still prints pure JSON"],"tags":["lima","json","version-check","parsing"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}