{"record":{"id":"4e0c989766874904","repo":"lima-vm/lima","slug":"template-does-not-define-param-q","errorCode":null,"errorMessage":"template does not define param %#q","messagePattern":"template does not define param %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/editflags/editflags.go","lineNumber":193,"sourceCode":"\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)\n\t}\n\texpr := fmt.Sprintf(\"[%s]\", strings.Join(mounts, \",\"))\n\treturn expr, nil","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/editflags/editflags.go#L175-L211","documentation":"BuildParamExpressions validates each NAME=VALUE parameter against the set of parameters the target template actually defines (allowedParams). This error is returned when the NAME is not a defined param in the template, so the override would have no effect or produce an invalid yq expression.","triggerScenarios":"Calling BuildParamExpressions with a key absent from allowedParams, e.g. --param cpuCount=4 against a template whose params only define 'cpus'; also happens when passing params to a template with no params at all.","commonSituations":"Typos in parameter names (cpus vs cpuCount vs cpu); using params from one template with another template; version drift where a template renamed or removed a param; forgetting the template:// prefix format differences.","solutions":["Inspect the template and use exactly its declared param names (e.g. --param cpus=4)","Fix typos in the parameter NAME","Use the appropriate generic flags (e.g. --cpus) instead of --param when the template has no such param","Update to a template version that still defines the param"],"exampleFix":"// before\nlimactl create template://_default --param cpuCount=4\n// after\nlimactl create template://_default --param cpus=4","handlingStrategy":"validation","validationCode":"for _, p := range params {\n\tkey, _, _ := strings.Cut(p, \"=\")\n\tif _, ok := allowedParams[key]; !ok {\n\t\treturn fmt.Errorf(\"template defines no param %q; allowed: %v\", key, keysOf(allowedParams))\n\t}\n}","typeGuard":"func paramAllowed(key string, allowed map[string]string) bool {\n\t_, ok := allowed[key]\n\treturn ok\n}","tryCatchPattern":"exprs, err := editflags.BuildParamExpressions(params, allowedParams)\nif err != nil {\n\treturn fmt.Errorf(\"--param rejected: %w (check the template's defined params)\", err)\n}","preventionTips":["Read the target template's params section before overriding","Watch for template renames across Lima versions","Prefer dedicated flags (--cpus, --memory) over --param when available"],"tags":["cli","template","parameters","lima"],"backgroundTag":"unknown-template-parameter","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}