lima-vm/lima · error
configuration is nil
Error message
configuration is nil
What it means
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.
Source
Thrown at pkg/driver/wsl2/wsl_driver_windows.go:99
if err := validateConfig(ctx, cfg); err != nil {
return nil, err
}
l.Instance = inst
l.SSHLocalPort = inst.SSHLocalPort
return &driver.ConfiguredDriver{
Driver: l,
}, nil
}
func (l *LimaWslDriver) Validate(ctx context.Context) error {
return validateConfig(ctx, l.Instance.Config)
}
func validateConfig(_ context.Context, cfg *limatype.LimaYAML) error {
if cfg == nil {
return errors.New("configuration is nil")
}
if cfg.MountType != nil && *cfg.MountType != limatype.WSLMount {
return fmt.Errorf("field `mountType` must be %#q for WSL2 driver, got %#q", limatype.WSLMount, *cfg.MountType)
}
// TODO: revise this list for WSL2
if cfg.VMType != nil {
if unknown := reflectutil.UnknownNonEmptyFields(cfg, knownYamlProperties...); len(unknown) > 0 {
logrus.Warnf("Ignoring: vmType %s: %+v", *cfg.VMType, unknown)
}
}
if cfg.OS != nil && *cfg.OS == limatype.WINDOWS {
return errors.New("currently Windows guest OS is only supported on QEMU")
}
if !limatype.IsNativeArch(*cfg.Arch) {
return fmt.Errorf("unsupported arch: %#q", *cfg.Arch)
}View on GitHub (pinned to dd909d0973)
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
Example fix
// before
driver.Validate(ctx) // cfg nil -> "configuration is nil"
// after
cfg, err := limayaml.Load(instConfigPath, "default")
if err != nil { return err }
inst.Config = cfg
driver.Configure(cfg)
driver.Validate(ctx) Defensive patterns
Strategy: type-guard
Validate before calling
const fs = require('fs');
const cfgPath = path.join(limaHome, 'instances', inst, 'lima.yaml');
if (!fs.existsSync(cfgPath)) throw new Error('Instance config missing at ' + cfgPath); Type guard
function hasConfig(inst) { return inst != null && inst.config != null && typeof inst.config === 'object'; } Try / catch
if (!hasConfig(driver.Instance)) {
throw new Error('Driver not configured: call Configure(cfg) with a loaded LimaYAML first');
}
try { await driver.Validate(ctx); } catch (e) {
if (e.message === 'configuration is nil') { /* reconfigure and retry */ }
else throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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`.
Related errors
- configuration is nil
- configuration is nil
- field `mountType` must be %#q for WSL2 driver, got %#q
- disk format %#q not supported, use `qcow2` or `raw` instead
- the YAML is invalid, attempted to save the buffer as %#q but
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/9fa07145dc0563a4.
Report an issue: GitHub.