{"record":{"id":"14f80c66eebf8116","repo":"lima-vm/lima","slug":"instance-or-its-configuration-is-not-properly-init","errorCode":null,"errorMessage":"instance or its configuration is not properly initialized","messagePattern":"instance or its configuration is not properly initialized","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driverutil/vm.go","lineNumber":48,"sourceCode":"\t}\n\n\t// Accept built-in VMType regardless of current platform.\n\tif slices.Contains(limatype.VMTypes, *y.VMType) {\n\t\treturn nil\n\t}\n\n\t// Also accept external drivers discovered in the registry.\n\t_, _, exists := registry.Get(*y.VMType)\n\tif !exists {\n\t\treturn fmt.Errorf(\"vmType %#q is not a registered driver\", *y.VMType)\n\t}\n\n\treturn nil\n}\n\nfunc InspectStatus(ctx context.Context, inst *limatype.Instance) (string, error) {\n\tif inst == nil || inst.Config == nil || inst.Config.VMType == nil {\n\t\treturn \"\", errors.New(\"instance or its configuration is not properly initialized\")\n\t}\n\n\textDriver, intDriver, exists := registry.Get(*inst.Config.VMType)\n\tif !exists {\n\t\treturn \"\", fmt.Errorf(\"unknown or unsupported VM type: %s\", *inst.Config.VMType)\n\t}\n\n\tif extDriver != nil {\n\t\tstatus, err := handleInspectStatusAction(ctx, inst, extDriver.Path)\n\t\tif err != nil {\n\t\t\textDriver.Logger.Errorf(\"Failed to inspect status for instance %#q: %v\", inst.Name, err)\n\t\t\treturn \"\", err\n\t\t}\n\t\textDriver.Logger.Debugf(\"Instance %#q inspected successfully with status: %s\", inst.Name, inst.Status)\n\t\treturn status, nil\n\t}\n\n\treturn intDriver.InspectStatus(ctx, inst), nil","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driverutil/vm.go#L30-L66","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nvar inst limatype.Instance\nstatus, err := driverutil.InspectStatus(ctx, &inst) // nil Config\n// after\ninst, err := store.Inspect(ctx, instName)\nif err != nil {\n    return err\n}\nstatus, err := driverutil.InspectStatus(ctx, inst)","handlingStrategy":"type-guard","validationCode":"if inst == nil || inst.Config == nil || inst.Config.VMType == nil {\n    return fmt.Errorf(\"instance %s not fully loaded\", instName)\n}\n// safe to call InspectStatus","typeGuard":"func inspectable(inst *limatype.Instance) bool {\n    return inst != nil && inst.Config != nil && inst.Config.VMType != nil\n}","tryCatchPattern":"status, err := driverutil.InspectStatus(ctx, inst)\nif err != nil {\n    if strings.Contains(err.Error(), \"not properly initialized\") {\n        return fmt.Errorf(\"reload instance %q from disk first\", inst.Name)\n    }\n    return err\n}","preventionTips":["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"],"tags":["configuration","nil-check","instance-state"],"backgroundTag":"uninitialized-config","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}