lima-vm/lima · error

inspect status command failed: %w; stderr: %s

Error message

inspect status command failed: %w; stderr: %s

What it means

After the external driver's --inspect-status process exits non-zero, this error reports the wait error plus everything the driver wrote to stderr. Lima throws it so the driver's own diagnostic output (why it could not inspect the instance) is surfaced to the limactl user.

Source

Thrown at pkg/driverutil/vm.go:110

	if err := encoder.Encode(payload); err != nil {
		return "", err
	}
	stdin.Close()

	decoder := json.NewDecoder(stdout)
	var response []byte
	if err := decoder.Decode(&response); err != nil {
		return "", err
	}

	var respInst limatype.Instance
	if err := respInst.UnmarshalJSON(response); err != nil {
		return "", fmt.Errorf("failed to unmarshal instance response: %w", err)
	}

	if err := cmd.Wait(); err != nil {
		if stderrBuf.Len() > 0 {
			return "", fmt.Errorf("inspect status command failed: %w; stderr: %s", err, stderrBuf.String())
		}
		return "", fmt.Errorf("inspect status command failed: %w", err)
	}

	if stderrBuf.Len() > 0 {
		logrus.Debugf("external driver stderr: %s", stderrBuf.String())
	}

	*inst = respInst
	logrus.Debugf("Inspecting instance status action completed successfully for %#q", extDriverPath)
	return inst.Status, nil
}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Read the stderr suffix — it contains the driver's own error message and points to the real fix
  2. Verify the instance directory is intact (lima.yaml, disk, iso present) and not locked by another lima process
  3. Reinstall/rebuild the external driver matching your Lima version
  4. Run the driver's --inspect-status manually with the same JSON on stdin to reproduce and debug

Example fix

// before: stderr: "lock: resource temporarily unavailable"
// another limactl holds the lock
// after
$ pkill -f lima-driver-foo && limactl list
Defensive patterns

Strategy: try-catch

Validate before calling

if err := exec.Command(extDriverPath, "--inspect-status", "--help").Run(); err != nil {
    return fmt.Errorf("external driver binary broken: %w", err)
}

Try / catch

status, err := driverutil.InspectStatus(ctx, inst)
if err != nil {
    if strings.Contains(err.Error(), "inspect status command failed") {
        if i := strings.Index(err.Error(), "stderr:"); i >= 0 {
            log.Errorf("driver stderr: %s", err.Error()[i:])
            // act on driver-specific message (lock, missing files, crash)
        }
    }
    return err
}

Prevention

When it happens

Trigger: cmd.Wait() returns a non-nil error for the external driver process — the driver exited with a non-zero status (bad instance JSON on stdin, missing VM state, internal panic) while stderrBuf was non-empty, so the stderr variant of the message is produced.

Common situations: External driver cannot find or lock the instance directory; VM is in a half-deleted state; driver binary incompatible with the piped Instance JSON; OS-level failures like missing dynamic libraries in the driver binary.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/0f4fa6ac4261fa63. Report an issue: GitHub.