{"record":{"id":"ff0db0db9fba910e","repo":"lima-vm/lima","slug":"failed-to-validate-the-instance-yaml-after-filling-ff0db0","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":"error","filePath":"pkg/instance/start.go","lineNumber":79,"sourceCode":"\tcase limatype.FREEBSD, limatype.WINDOWS:\n\t\t// guest agent is not implemented for FreeBSD and Windows yet\n\t\tneedsGuestAgent = false\n\tdefault:\n\t\tneedsGuestAgent = !*inst.Config.Plain\n\t}\n\tif needsGuestAgent && guestAgent == \"\" {\n\t\tvar err error\n\t\tguestAgent, err = usrlocal.GuestAgentBinary(*inst.Config.OS, *inst.Config.Arch)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tlimaDriver, err := driverutil.CreateConfiguredDriver(ctx, inst, 0)\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\n\tif err := limaDriver.Validate(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := limaDriver.Create(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Migrate legacy disk layout (diffdisk → disk, ISO basedisk → iso)\n\tif err := driverutil.MigrateDiskLayout(inst.Dir); err != nil {\n\t\treturn nil, err\n\t}\n\n\tsupportedImageFormats := limaDriver.Info(ctx).Features.SupportedImageFormats\n\n\tcreated := limayaml.IsExistingInstanceDir(inst.Dir)","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/instance/start.go#L61-L97","documentation":"After CreateConfiguredDriver fills in defaults, Prepare re-validates the full instance YAML with limayaml.Validate(inst.Config, true). This catches config that only becomes invalid after defaults are applied (conflicting fields, out-of-range values, missing images, etc.). The error wraps the validation details.","triggerScenarios":"Calling limactl start (Start -> StartWithPaths -> Prepare) with an instance whose resolved lima.yaml violates schema/constraints - e.g. invalid arch, mounts pointing outside allowed dirs, cpus/memory misformatted, or defaults yielding an invalid combination.","commonSituations":"Hand-editing ~/.lima/<inst>/lima.yaml; upgrading Lima so new validation rules reject old configs; template edits via limactl edit that pass yq but fail schema validation.","solutions":["Read the inner validation message; it lists the exact offending field.","Run `limactl edit <inst>` (or `limactl start <inst>` interactive editor) and fix the reported field.","Validate the template file standalone before applying: `limactl start ./template.yaml` on a fresh instance or limayaml lint equivalents.","If an upgrade introduced it, compare against the release notes and migrate the deprecated field."],"exampleFix":"// before (lima.yaml)\ncpus: \"four\"\n// after\ncpus: 4","handlingStrategy":"validation","validationCode":"// validate the instance config the same way Prepare does, before starting\ny, err := limayaml.Load(o.Paths.LimaYAML, \"default\")\nif err != nil { return err }\nif err := limayaml.Validate(y, true); err != nil {\n  return fmt.Errorf(\"instance config invalid: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always edit via `limactl edit` so validation runs on save","Re-validate existing instances after Lima upgrades","Avoid hand-editing ~/.lima/<inst>/lima.yaml with schema knowledge only from old docs","Test new templates on a throwaway instance before production"],"tags":["validation","limayaml","config"],"backgroundTag":"schema-validation-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}