{"record":{"id":"22204527c88ad504","repo":"lima-vm/lima","slug":"no-requeststop-function-available","errorCode":null,"errorMessage":"no RequestStop function available","messagePattern":"no RequestStop function available","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/autostart/managers.go","lineNumber":148,"sourceCode":"}\n\nfunc (t *TemplateFileBasedManager) AutoStartedIdentifier() string {\n\tif t.autoStartedIdentifier != nil {\n\t\treturn t.autoStartedIdentifier()\n\t}\n\treturn \"\"\n}\n\nfunc (t *TemplateFileBasedManager) RequestStart(ctx context.Context, inst *limatype.Instance) error {\n\tif t.requestStart == nil {\n\t\treturn errors.New(\"no RequestStart function available\")\n\t}\n\treturn t.requestStart(ctx, inst)\n}\n\nfunc (t *TemplateFileBasedManager) RequestStop(ctx context.Context, inst *limatype.Instance) (bool, error) {\n\tif t.requestStop == nil {\n\t\treturn false, errors.New(\"no RequestStop function available\")\n\t}\n\treturn t.requestStop(ctx, inst)\n}\n","sourceCodeStart":130,"sourceCodeEnd":152,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/autostart/managers.go#L130-L152","documentation":"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.","triggerScenarios":"Calling RequestStop (used when the guestagent/hostagent decides an auto-started instance should stop) on a manager constructed without the requestStop function.","commonSituations":"Same family as 214: custom builds, partial test managers, or platforms where the stop callback is unimplemented.","solutions":["Construct the manager via the OS-specific constructor that wires requestStop (pkg/autostart/systemd.RequestStop)","Provide your own requestStop when embedding; it should return (true, nil) after stopping, (false, nil) if the instance wasn't auto-started","Handle the error by stopping the instance through the normal lima instance lifecycle instead"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// treat autostart stop as optional: only call it for systemd-registered instances\nif runtime.GOOS != \"linux\" && runtime.GOOS != \"darwin\" {\n    return limainstance.Stop(ctx, inst) // use normal stop\n}\n","typeGuard":null,"tryCatchPattern":"stopped, err := mgr.RequestStop(ctx, inst)\nif err != nil {\n    if strings.Contains(err.Error(), \"no RequestStop function available\") {\n        return limainstance.Stop(ctx, inst)\n    }\n    return err\n}\nif !stopped {\n    return limainstance.Stop(ctx, inst) // wasn't systemd-started\n}\n","preventionTips":["Construct managers via NewSystemd/NewLaunchd so requestStop is wired","Always pair RequestStop with a normal-stop fallback since it returns (false, nil) for non-auto-started instances","In custom managers, implement requestStop before shipping"],"tags":["autostart","api-misuse","configuration"],"backgroundTag":"missing-callback-implementation","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}