lima-vm/lima · error
configuration is nil
Error message
configuration is nil
What it means
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.
Source
Thrown at pkg/driver/qemu/qemu_driver.go:100
l.Instance = inst
l.SSHLocalPort = inst.SSHLocalPort
return &driver.ConfiguredDriver{
Driver: l,
}, nil
}
func (l *LimaQemuDriver) Validate(ctx context.Context) error {
if err := validateArch(ctx, l.Instance.Config); err != nil {
return err
}
return validateConfig(l.Instance.Config)
}
func validateConfig(cfg *limatype.LimaYAML) error {
if cfg == nil {
return errors.New("configuration is nil")
}
if err := validateMountType(cfg); err != nil {
return err
}
for i, nw := range cfg.Networks {
if unknown := reflectutil.UnknownNonEmptyFields(nw,
"Lima",
"Socket",
"MACAddress",
"Metric",
"Interface",
); len(unknown) > 0 {
logrus.Warnf("vmType %s: ignoring networks[%d]: %+v", *cfg.VMType, i, unknown)
}
}
var qemuOpts limatype.QEMUOptsView on GitHub (pinned to dd909d0973)
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.
Example fix
// before
inst := &limatype.Instance{}
drv.Validate(ctx)
// after
inst.Config = loadedLimaYAML // from limayaml.LoadYAML
Defensive patterns
Strategy: type-guard
Validate before calling
if inst == nil || inst.Config == nil {
return errors.New("instance config not loaded; load via limayaml before driver.Validate()")
} Type guard
func hasConfig(inst *limatype.Instance) bool { return inst != nil && inst.Config != nil } Try / catch
if err := drv.Validate(ctx); err != nil && strings.Contains(err.Error(), "configuration is nil") {
// load the instance config before retrying; this indicates a caller bug
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- configuration is nil
- field `vmOpts.qemu.minimumVersion` must be a semvar value, g
- mount type %#q is explicitly unsupported
- field `mountType` must be one of %v for QEMU driver on Linux
- field `mountType` must be %#q or %#q for QEMU driver on macO
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/e67e61d0be534953.
Report an issue: GitHub.