lima-vm/lima · error
instance or its configuration is not properly initialized
Error message
instance or its configuration is not properly initialized
What it means
InspectStatus requires a fully loaded Instance: non-nil instance, non-nil Config, and non-nil Config.VMType. This sentinel error means the caller passed an instance object that was never populated from disk (e.g. zero-value Instance or partially loaded struct), so Lima cannot determine which driver to ask.
Source
Thrown at pkg/driverutil/vm.go:48
}
// Accept built-in VMType regardless of current platform.
if slices.Contains(limatype.VMTypes, *y.VMType) {
return nil
}
// Also accept external drivers discovered in the registry.
_, _, exists := registry.Get(*y.VMType)
if !exists {
return fmt.Errorf("vmType %#q is not a registered driver", *y.VMType)
}
return nil
}
func InspectStatus(ctx context.Context, inst *limatype.Instance) (string, error) {
if inst == nil || inst.Config == nil || inst.Config.VMType == nil {
return "", errors.New("instance or its configuration is not properly initialized")
}
extDriver, intDriver, exists := registry.Get(*inst.Config.VMType)
if !exists {
return "", fmt.Errorf("unknown or unsupported VM type: %s", *inst.Config.VMType)
}
if extDriver != nil {
status, err := handleInspectStatusAction(ctx, inst, extDriver.Path)
if err != nil {
extDriver.Logger.Errorf("Failed to inspect status for instance %#q: %v", inst.Name, err)
return "", err
}
extDriver.Logger.Debugf("Instance %#q inspected successfully with status: %s", inst.Name, inst.Status)
return status, nil
}
return intDriver.InspectStatus(ctx, inst), nilView on GitHub (pinned to dd909d0973)
Solutions
- Ensure the instance is loaded via the normal store/load path (limactl list / LoadYCtxByFilePath) rather than a zero-value struct
- Check ~/.lima/<instance>/lima.yaml exists and parses; restore or recreate the instance if corrupt
- Recreate the instance with `limactl delete <name> && limactl start <name>` if the config is unrecoverable
- In code, nil-check inst.Config and inst.Config.VMType before calling InspectStatus
Example fix
// before
var inst limatype.Instance
status, err := driverutil.InspectStatus(ctx, &inst) // nil Config
// after
inst, err := store.Inspect(ctx, instName)
if err != nil {
return err
}
status, err := driverutil.InspectStatus(ctx, inst) Defensive patterns
Strategy: type-guard
Validate before calling
if inst == nil || inst.Config == nil || inst.Config.VMType == nil {
return fmt.Errorf("instance %s not fully loaded", instName)
}
// safe to call InspectStatus Type guard
func inspectable(inst *limatype.Instance) bool {
return inst != nil && inst.Config != nil && inst.Config.VMType != nil
} Try / catch
status, err := driverutil.InspectStatus(ctx, inst)
if err != nil {
if strings.Contains(err.Error(), "not properly initialized") {
return fmt.Errorf("reload instance %q from disk first", inst.Name)
}
return err
} Prevention
- Always obtain Instance via the standard store/load APIs, never zero-value
- Check that ~/.lima/<instance>/lima.yaml exists before inspecting
- Complete `limactl create` before querying status
When it happens
Trigger: Calling InspectStatus (via the inspectStatus limactl action) with an Instance whose Config or Config.VMType is nil — typically from loading a corrupt/absent lima.yaml, or constructing the Instance manually without LoadYCtxByFilePath.
Common situations: Instance directory missing lima.yaml (partial delete); YAML failed to parse earlier so Config stayed nil; programmatic use of the driverutil API with a hand-built limatype.Instance; interrupted instance creation.
Related errors
- unsupported shell %#q for Windows guest, must be one of %v
- instance %#q is stopped, run `limactl start %s` to start the
- no volume with role %#x found
- no template available
- no RequestStart function available
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/14f80c66eebf8116.
Report an issue: GitHub.