lima-vm/lima · error

no RequestStop function available

Error message

no RequestStop function available

What it means

TemplateFileBasedManager.RequestStop returns this error when its injected requestStop callback is nil. The manager has no way to ask systemd/launchd to stop the auto-started instance, so it fails fast instead of silently returning false.

Source

Thrown at pkg/autostart/managers.go:148

}

func (t *TemplateFileBasedManager) AutoStartedIdentifier() string {
	if t.autoStartedIdentifier != nil {
		return t.autoStartedIdentifier()
	}
	return ""
}

func (t *TemplateFileBasedManager) RequestStart(ctx context.Context, inst *limatype.Instance) error {
	if t.requestStart == nil {
		return errors.New("no RequestStart function available")
	}
	return t.requestStart(ctx, inst)
}

func (t *TemplateFileBasedManager) RequestStop(ctx context.Context, inst *limatype.Instance) (bool, error) {
	if t.requestStop == nil {
		return false, errors.New("no RequestStop function available")
	}
	return t.requestStop(ctx, inst)
}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Construct the manager via the OS-specific constructor that wires requestStop (pkg/autostart/systemd.RequestStop)
  2. Provide your own requestStop when embedding; it should return (true, nil) after stopping, (false, nil) if the instance wasn't auto-started
  3. Handle the error by stopping the instance through the normal lima instance lifecycle instead
Defensive patterns

Strategy: try-catch

Validate before calling

// treat autostart stop as optional: only call it for systemd-registered instances
if runtime.GOOS != "linux" && runtime.GOOS != "darwin" {
    return limainstance.Stop(ctx, inst) // use normal stop
}

Try / catch

stopped, err := mgr.RequestStop(ctx, inst)
if err != nil {
    if strings.Contains(err.Error(), "no RequestStop function available") {
        return limainstance.Stop(ctx, inst)
    }
    return err
}
if !stopped {
    return limainstance.Stop(ctx, inst) // wasn't systemd-started
}

Prevention

When it happens

Trigger: Calling RequestStop (used when the guestagent/hostagent decides an auto-started instance should stop) on a manager constructed without the requestStop function.

Common situations: Same family as 214: custom builds, partial test managers, or platforms where the stop callback is unimplemented.

Related errors


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