{"record":{"id":"13f561f884ce36a1","repo":"lima-vm/lima","slug":"invalid-parameter-q-expected-static-followed","errorCode":null,"errorMessage":"invalid parameter %#q, expected `static=` followed by a boolean value","messagePattern":"invalid parameter %#q, expected `static=` followed by a boolean value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/editflags/editflags.go","lineNumber":161,"sourceCode":"\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 {\n\t\t\treturn \"\", err\n\t\t}\n\t\tports[i] = fmt.Sprintf(`{\"guestPort\": %q, \"hostPort\": %q, \"static\": %v}`, guestPort, hostPort, isStatic)","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/editflags/editflags.go#L143-L179","documentation":"ParsePortForward requires the optional second segment after the comma to be exactly `static=` followed by a boolean. This error is returned when the segment does not have the `static=` prefix at all (e.g. `8080:80,mode=tcp` or a stray comma).","triggerScenarios":"Calling ParsePortForward / BuildPortForwardExpression with a spec whose second comma segment is not `static=<bool>`, e.g. '8080:80,static' (missing =), '8080:80,permanent=true', or '8080:80,' (trailing comma producing an empty segment).","commonSituations":"Users guessing the parameter name (writing 'static' without '=', or another flag name); trailing commas from scripted flag lists; copying syntax from other port-forwarding tools.","solutions":["Use the exact syntax `static=true` or `static=false` as the second segment, e.g. '9090:9090,static=true'","Remove extra commas or unknown parameters from the flag value","Pass only HOST:GUEST if you do not need a static forward"],"exampleFix":"// before\nlimactl create --port-forward '8080:80,static'\n// after\nlimactl create --port-forward '8080:80,static=true'","handlingStrategy":"validation","validationCode":"func validPortForwardSpec(spec string) error {\n\tparts := strings.Split(spec, \",\")\n\tif len(parts) > 2 {\n\t\treturn fmt.Errorf(\"too many segments in %q\", spec)\n\t}\n\tif !strings.Contains(parts[0], \":\") {\n\t\treturn fmt.Errorf(\"expected HOST:GUEST in %q\", spec)\n\t}\n\tif len(parts) == 2 {\n\t\tp := strings.TrimSpace(parts[1])\n\t\tif !strings.HasPrefix(p, \"static=\") {\n\t\t\treturn fmt.Errorf(\"second segment %q must be static=<bool>\", p)\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":"func hasStaticParam(part string) bool {\n\t_, ok := strings.CutPrefix(strings.TrimSpace(part), \"static=\")\n\treturn ok\n}","tryCatchPattern":"_, _, _, err := editflags.ParsePortForward(spec)\nif err != nil {\n\treturn fmt.Errorf(\"invalid --port-forward %q: %w (format: HOST:GUEST[,static=true])\", spec, err)\n}","preventionTips":["Use the documented syntax HOST:GUEST,static=true exactly","Avoid trailing commas in scripted flag lists","Do not invent extra parameters — only `static=` is supported in the second segment"],"tags":["cli","port-forward","argument-parsing","lima"],"backgroundTag":"invalid-flag-parameter-syntax","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}