{"record":{"id":"9fa07145dc0563a4","repo":"lima-vm/lima","slug":"configuration-is-nil-9fa071","errorCode":null,"errorMessage":"configuration is nil","messagePattern":"configuration is nil","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/wsl2/wsl_driver_windows.go","lineNumber":99,"sourceCode":"\tif err := validateConfig(ctx, cfg); err != nil {\n\t\treturn nil, err\n\t}\n\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 *LimaWslDriver) Validate(ctx context.Context) error {\n\treturn validateConfig(ctx, l.Instance.Config)\n}\n\nfunc validateConfig(_ context.Context, cfg *limatype.LimaYAML) error {\n\tif cfg == nil {\n\t\treturn errors.New(\"configuration is nil\")\n\t}\n\tif cfg.MountType != nil && *cfg.MountType != limatype.WSLMount {\n\t\treturn fmt.Errorf(\"field `mountType` must be %#q for WSL2 driver, got %#q\", limatype.WSLMount, *cfg.MountType)\n\t}\n\t// TODO: revise this list for WSL2\n\tif cfg.VMType != nil {\n\t\tif unknown := reflectutil.UnknownNonEmptyFields(cfg, knownYamlProperties...); len(unknown) > 0 {\n\t\t\tlogrus.Warnf(\"Ignoring: vmType %s: %+v\", *cfg.VMType, unknown)\n\t\t}\n\t}\n\n\tif cfg.OS != nil && *cfg.OS == limatype.WINDOWS {\n\t\treturn errors.New(\"currently Windows guest OS is only supported on QEMU\")\n\t}\n\n\tif !limatype.IsNativeArch(*cfg.Arch) {\n\t\treturn fmt.Errorf(\"unsupported arch: %#q\", *cfg.Arch)\n\t}","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/wsl2/wsl_driver_windows.go#L81-L117","documentation":"Error returned by the WSL2 driver's validateConfig (pkg/driver/wsl2/wsl_driver_windows.go:99) when the driver's Validate is called with a nil instance configuration (*limatype.LimaYAML). This indicates an internal inconsistency (e.g. the instance record has no loaded config) rather than a user YAML problem, since a nil config normally fails earlier during template load. Fix by ensuring the instance was created from a valid lima.yaml and that the config was properly attached to the driver before validation.","triggerScenarios":"LimaWslDriver.Validate, Configure, or an internal caller passes l.Instance.Config == nil — e.g. an instance record created without a loaded config or a corrupted instance directory missing lima.yaml.","commonSituations":"Instance directory missing/corrupted (lima.yaml deleted); programmatic use of the driver API without calling Configure; loading an instance from a partial/failed `limactl create`.","solutions":["Recreate the instance (delete and re-create) to rebuild its config","Update Lima to a version where the nil check is fixed","Report as a bug with the steps that led to it"],"exampleFix":"// before\ndriver.Validate(ctx) // cfg nil -> \"configuration is nil\"\n// after\ncfg, err := limayaml.Load(instConfigPath, \"default\")\nif err != nil { return err }\ninst.Config = cfg\ndriver.Configure(cfg)\ndriver.Validate(ctx)","handlingStrategy":"type-guard","validationCode":"const fs = require('fs');\nconst cfgPath = path.join(limaHome, 'instances', inst, 'lima.yaml');\nif (!fs.existsSync(cfgPath)) throw new Error('Instance config missing at ' + cfgPath);","typeGuard":"function hasConfig(inst) { return inst != null && inst.config != null && typeof inst.config === 'object'; }","tryCatchPattern":"if (!hasConfig(driver.Instance)) {\n  throw new Error('Driver not configured: call Configure(cfg) with a loaded LimaYAML first');\n}\ntry { await driver.Validate(ctx); } catch (e) {\n  if (e.message === 'configuration is nil') { /* reconfigure and retry */ }\n  else throw e;\n}","preventionTips":["Always load lima.yaml into Instance.Config before invoking driver methods","Do not delete or edit lima.yaml under LIMA_HOME/instances/<name> manually","Recreate instances whose config file is missing: limactl delete && limactl create"],"tags":["wsl2","validation","nil-config"],"backgroundTag":"nil-config","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}