{"record":{"id":"1e7a5aa767d37367","repo":"lima-vm/lima","slug":"failed-to-validate-the-instance-yaml-after-filling","errorCode":null,"errorMessage":"failed to validate the instance YAML after filling defaults: %w","messagePattern":"failed to validate the instance YAML after filling defaults: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/hostagent/hostagent.go","lineNumber":174,"sourceCode":"\n\tvar udpDNSLocalPort, tcpDNSLocalPort int\n\tif limayaml.HostResolverEnabled(inst.Config) {\n\t\tudpDNSLocalPort, err = freeport.UDP()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttcpDNSLocalPort, err = freeport.TCP()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tlimaDriver, err := driverutil.CreateConfiguredDriver(ctx, inst, sshLocalPort)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create driver instance: %w\", err)\n\t}\n\tif err := limayaml.Validate(inst.Config, true); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to validate the instance YAML after filling defaults: %w\", err)\n\t}\n\tsshLocalPort = inst.SSHLocalPort\n\n\tinfo := limaDriver.Info(ctx)\n\tvSockPort := info.VsockPort\n\tvirtioPort := info.VirtioPort\n\tnoCloudInit := info.Features.NoCloudInit\n\trosettaEnabled := info.Features.RosettaEnabled\n\trosettaBinFmt := info.Features.RosettaBinFmt\n\n\t// Disable Rosetta in Plain mode\n\tif *inst.Config.Plain {\n\t\trosettaEnabled = false\n\t\trosettaBinFmt = false\n\t}\n\n\tvar iid string\n\tswitch *inst.Config.OS {","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/hostagent/hostagent.go#L156-L192","documentation":"After creating the driver, HostAgent.New re-runs limayaml.Validate on the instance config with warnings enabled, verifying the YAML is still valid once defaults are filled in. Failure means the defaulted config violates the Lima schema or semantic constraints; the error is wrapped with this message.","triggerScenarios":"limactl start (via hostagentAction → hostagent.New) on an instance whose lima.yaml — after ApplyDefaults — fails validation: invalid enum values, contradictory fields, out-of-range numbers, or invalid combinations of plain/mount/disk settings.","commonSituations":"Hand-edited lima.yaml introducing an invalid value; config produced by a newer Lima version then loaded by an older limactl; template merge producing conflicting fields; typos in field names that default wrongly.","solutions":["Read the wrapped limayaml validation error — it names the exact offending field and constraint","Fix the invalid field in ~/.lima/<instance>/lima.yaml (or the source template and re-provision)","Run 'limactl validate <file>' on your YAML before starting to catch issues early","Ensure the limactl binary version matches the Lima version that created the instance"],"exampleFix":"// before (lima.yaml)\ncpus: \"four\"\n// after\ncpus: 4","handlingStrategy":"validation","validationCode":"// pre-validate the config before starting the instance\nyamlBytes, _ := os.ReadFile(\"~/.lima/default/lima.yaml\")\ny, err := limayaml.Load(yamlBytes, \"<file>\")\nif err != nil { return err }\nif err := limayaml.Validate(limayaml.FillDefaults(y), true); err != nil {\n\treturn fmt.Errorf(\"config invalid before start: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"err := limayaml.Validate(inst.Config, true)\nif err != nil {\n\t// surface field-level errors to the user instead of a generic start failure\n\treturn fmt.Errorf(\"fix lima.yaml: %w\", err)\n}","preventionTips":["Run 'limactl validate <file>' after every YAML edit","Avoid hand-editing instance YAML in ~/.lima; edit the source template and re-provision","Use matching Lima versions across machines sharing configs","Keep field names/values from the official schema docs, not guesses"],"tags":["validation","yaml","config","limayaml"],"backgroundTag":"schema-validation-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}