{"record":{"id":"e67e61d0be534953","repo":"lima-vm/lima","slug":"configuration-is-nil-e67e61","errorCode":null,"errorMessage":"configuration is nil","messagePattern":"configuration is nil","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/qemu/qemu_driver.go","lineNumber":100,"sourceCode":"\n\tl.Instance = inst\n\tl.SSHLocalPort = inst.SSHLocalPort\n\n\treturn &driver.ConfiguredDriver{\n\t\tDriver: l,\n\t}, nil\n}\n\nfunc (l *LimaQemuDriver) Validate(ctx context.Context) error {\n\tif err := validateArch(ctx, l.Instance.Config); err != nil {\n\t\treturn err\n\t}\n\treturn validateConfig(l.Instance.Config)\n}\n\nfunc validateConfig(cfg *limatype.LimaYAML) error {\n\tif cfg == nil {\n\t\treturn errors.New(\"configuration is nil\")\n\t}\n\tif err := validateMountType(cfg); err != nil {\n\t\treturn err\n\t}\n\n\tfor i, nw := range cfg.Networks {\n\t\tif unknown := reflectutil.UnknownNonEmptyFields(nw,\n\t\t\t\"Lima\",\n\t\t\t\"Socket\",\n\t\t\t\"MACAddress\",\n\t\t\t\"Metric\",\n\t\t\t\"Interface\",\n\t\t); len(unknown) > 0 {\n\t\t\tlogrus.Warnf(\"vmType %s: ignoring networks[%d]: %+v\", *cfg.VMType, i, unknown)\n\t\t}\n\t}\n\n\tvar qemuOpts limatype.QEMUOpts","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/qemu/qemu_driver.go#L82-L118","documentation":"QEMU driver Validate()/fillConfig() call validateConfig() with the instance's LimaYAML config. If the *limatype.LimaYAML pointer is nil, there is nothing to validate, so it returns this sentinel error immediately. It is an internal invariant check rather than a user-config problem.","triggerScenarios":"Calling driver.Validate() or fillConfig() on a QEMU driver whose `l.Instance.Config` is nil — i.e. an Instance that was never loaded/initialized from a lima.yaml file.","commonSituations":"Programmatic use of the driver package with a hand-built Instance struct; reading an instance whose config file failed to load earlier; tests constructing drivers without config.","solutions":["Ensure the Instance is created/loaded through the normal limactl flow so Config is populated before Validate().","If constructing programmatically, load the YAML via the limayaml loader and assign it to Instance.Config first.","Treat this as a bug in your calling code — the driver never expects a nil config in production."],"exampleFix":"// before\ninst := &limatype.Instance{}\ndrv.Validate(ctx)\n// after\ninst.Config = loadedLimaYAML // from limayaml.LoadYAML\n","handlingStrategy":"type-guard","validationCode":"if inst == nil || inst.Config == nil {\n    return errors.New(\"instance config not loaded; load via limayaml before driver.Validate()\")\n}","typeGuard":"func hasConfig(inst *limatype.Instance) bool { return inst != nil && inst.Config != nil }","tryCatchPattern":"if err := drv.Validate(ctx); err != nil && strings.Contains(err.Error(), \"configuration is nil\") {\n    // load the instance config before retrying; this indicates a caller bug\n}","preventionTips":["Always create Instances through the standard limactl/instance package flow.","Load lima.yaml via the limayaml loader before constructing a driver.","Add an early nil-check on Instance.Config in programmatic drivers."],"tags":["qemu","validation","nil-config","internal"],"backgroundTag":"nil-config","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}