{"record":{"id":"58418b0773458df7","repo":"lima-vm/lima","slug":"invalid-value-for-static-parameter-q","errorCode":null,"errorMessage":"invalid value for static parameter: %#q","messagePattern":"invalid value for static parameter: %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/editflags/editflags.go","lineNumber":158,"sourceCode":"\tparts := strings.Split(spec, \",\")\n\tif len(parts) > 2 {\n\t\treturn \"\", \"\", false, fmt.Errorf(\"invalid port forward format %#q, expected HOST:GUEST or HOST:GUEST,static=true\", spec)\n\t}\n\n\tportParts := strings.Split(strings.TrimSpace(parts[0]), \":\")\n\tif len(portParts) != 2 {\n\t\treturn \"\", \"\", false, fmt.Errorf(\"invalid port forward format %#q, expected HOST:GUEST\", parts[0])\n\t}\n\n\thostPort = strings.TrimSpace(portParts[0])\n\tguestPort = strings.TrimSpace(portParts[1])\n\n\tif len(parts) == 2 {\n\t\tstaticPart := strings.TrimSpace(parts[1])\n\t\tif staticValue, ok := strings.CutPrefix(staticPart, \"static=\"); ok {\n\t\t\tisStatic, err = strconv.ParseBool(staticValue)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", \"\", false, fmt.Errorf(\"invalid value for static parameter: %#q\", staticValue)\n\t\t\t}\n\t\t} else {\n\t\t\treturn \"\", \"\", false, fmt.Errorf(\"invalid parameter %#q, expected `static=` followed by a boolean value\", staticPart)\n\t\t}\n\t}\n\n\treturn hostPort, guestPort, isStatic, nil\n}\n\nfunc BuildPortForwardExpression(portForwards []string) (string, error) {\n\tif len(portForwards) == 0 {\n\t\treturn \"\", nil\n\t}\n\n\tports := make([]string, len(portForwards))\n\tfor i, spec := range portForwards {\n\t\thostPort, guestPort, isStatic, err := ParsePortForward(spec)\n\t\tif err != nil {","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/editflags/editflags.go#L140-L176","documentation":"ParsePortForward parses a --port-forward flag value of the form HOST:GUEST or HOST:GUEST,static=true. When the optional second comma-separated segment starts with `static=`, the remainder must be a valid Go boolean (strconv.ParseBool accepts 1,0,t,f,true,false,TRUE,FALSE...). This error is returned when the text after `static=` is not parseable as a bool.","triggerScenarios":"Calling ParsePortForward (directly or via BuildPortForwardExpression from limactl edit/create --port-forward) with a spec like '8080:80,static=yes', '8080:80,static=', or '8080:80,static=on' — any non-boolean value after static=.","commonSituations":"Users typing shell-style truthy words (yes/no/on/off) instead of Go booleans; typos like 'static=tue'; scripts interpolating empty variables producing 'static='; copying examples from other tools that use yes/no.","solutions":["Use a Go-parseable boolean: true/false/1/0/t/f/T/F/TRUE/FALSE (e.g. --port-forward 8080:80,static=true)","Check for typos or whitespace in the value after static=","If you need yes/no semantics, normalize the value before passing it in"],"exampleFix":"// before\nlimactl create --port-forward '8080:80,static=yes'\n// after\nlimactl create --port-forward '8080:80,static=true'","handlingStrategy":"validation","validationCode":"func validStaticValue(v string) bool {\n\t_, err := strconv.ParseBool(v)\n\treturn err == nil\n}\n// spec := \"8080:80,static=true\"\n// if parts := strings.Split(spec, \",\"); len(parts) == 2 {\n// \tif sv, ok := strings.CutPrefix(strings.TrimSpace(parts[1]), \"static=\"); !ok || !validStaticValue(sv) {\n// \t\treturn fmt.Errorf(\"bad port-forward spec %q\", spec)\n// \t}\n// }","typeGuard":"func isParseableBool(s string) bool {\n\t_, err := strconv.ParseBool(s)\n\treturn err == nil\n}","tryCatchPattern":"hostPort, guestPort, isStatic, err := editflags.ParsePortForward(spec)\nif err != nil {\n\treturn fmt.Errorf(\"--port-forward %q rejected: %w (use HOST:GUEST[,static=true|false])\", spec, err)\n}","preventionTips":["Always use true/false (or 1/0) after static=, never yes/no/on/off","Quote flag values in shell to avoid stray spaces","Add a CLI-side validation or completion hint for the port-forward format"],"tags":["cli","port-forward","argument-parsing","lima"],"backgroundTag":"invalid-boolean-flag-value","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}