{"record":{"id":"ed0672a5224d0964","repo":"lima-vm/lima","slug":"invalid-parameter-q-expected-name-value","errorCode":null,"errorMessage":"invalid parameter %#q, expected NAME=VALUE","messagePattern":"invalid parameter %#q, expected NAME=VALUE","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/editflags/editflags.go","lineNumber":190,"sourceCode":"\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)\n\t}\n\texpr := fmt.Sprintf(\".portForwards += [%s]\", strings.Join(ports, \",\"))\n\treturn expr, nil\n}\n\nfunc BuildParamExpressions(params []string, allowedParams map[string]string) ([]string, error) {\n\texprs := make([]string, len(params))\n\tfor i, param := range params {\n\t\tkey, value, ok := strings.Cut(param, \"=\")\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid parameter %#q, expected NAME=VALUE\", param)\n\t\t}\n\t\tif _, ok := allowedParams[key]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"template does not define param %#q\", key)\n\t\t}\n\t\texprs[i] = fmt.Sprintf(\".param[%q] = %q\", key, value)\n\t}\n\treturn exprs, nil\n}\n\nfunc buildMountListExpression(ss []string) (string, error) {\n\tmounts := make([]string, len(ss))\n\tfor i, s := range ss {\n\t\twritable := strings.HasSuffix(s, \":w\")\n\t\tloc, err := localpathutil.Expand(strings.TrimSuffix(s, \":w\"))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tmounts[i] = fmt.Sprintf(`{\"location\": %q, \"mountPoint\": %q, \"writable\": %v}`, loc, loc, writable)","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/editflags/editflags.go#L172-L208","documentation":"BuildParamExpressions converts --param flag values into yq expressions for template parameter overrides. Each value must be in NAME=VALUE form. This error is returned when a parameter string contains no '=' so no key/value pair can be extracted.","triggerScenarios":"Calling BuildParamExpressions (from limactl create/edit --param) with an entry lacking '=', e.g. --param 'cpuCount' or --param 'cpuCount:' instead of --param 'cpuCount=4'.","commonSituations":"Users passing just a parameter name forgetting the value; using ':' or space separators from other CLI conventions; shell variable expansion dropping the value so only 'NAME=' residue or 'NAME' remains.","solutions":["Pass the parameter as NAME=VALUE, e.g. --param cpuCount=4","Quote the argument in the shell so '=' is not interpreted oddly: --param 'cpuCount=4'","List the template's params (template must define the NAME too, see error 48)"],"exampleFix":"// before\nlimactl create template://_default --param cpuCount\n// after\nlimactl create template://_default --param cpuCount=4","handlingStrategy":"validation","validationCode":"func validParam(p string) bool {\n\tkey, _, ok := strings.Cut(p, \"=\")\n\treturn ok && key != \"\"\n}\n// for _, p := range params {\n// \tif !validParam(p) { return fmt.Errorf(\"param %q must be NAME=VALUE\", p) }\n// }","typeGuard":"func isNameValue(s string) bool {\n\t_, _, ok := strings.Cut(s, \"=\")\n\treturn ok\n}","tryCatchPattern":"exprs, err := editflags.BuildParamExpressions(params, allowedParams)\nif err != nil {\n\treturn fmt.Errorf(\"bad --param argument: %w (expected NAME=VALUE)\", err)\n}","preventionTips":["Always pass --param as NAME=VALUE with a literal '='","Quote arguments in shell so '=' survives quoting","Validate user-supplied params before invoking limactl"],"tags":["cli","template","parameters","argument-parsing","lima"],"backgroundTag":"missing-key-value-pair","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}