{"record":{"id":"5b6d58e9e8f11a6d","repo":"lima-vm/lima","slug":"external-driver-process-exited-before-creating-soc-5b6d58","errorCode":null,"errorMessage":"external driver process exited before creating socket file: %w","messagePattern":"external driver process exited before creating socket file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/external/server/server.go","lineNumber":264,"sourceCode":"\t\tcase <-ticker.C:\n\t\t\tif _, err := os.Stat(socketPath); err == nil && isServerRunning(socketPath) {\n\t\t\t\tdriverLogger.Debugf(\"Detected socket file at %s\", socketPath)\n\t\t\t\textDriver.Client, err = client.NewDriverClient(socketPath, extDriver.Logger)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif err := cmd.Process.Kill(); err != nil {\n\t\t\t\t\t\tdriverLogger.Errorf(\"Failed to kill external driver process after client creation failure: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t\t<-procExit\n\t\t\t\t\treturn fmt.Errorf(\"failed to create driver client: %w\", err)\n\t\t\t\t}\n\t\t\t\tdriverLogger.Debugf(\"External driver %s started successfully\", extDriver.Name)\n\t\t\t\treturn nil\n\t\t\t}\n\t\tcase waitErr := <-procExit:\n\t\t\tif waitErr == nil {\n\t\t\t\treturn errors.New(\"external driver process exited before creating socket file\")\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"external driver process exited before creating socket file: %w\", waitErr)\n\t\tcase <-socketWaitCtx.Done():\n\t\t\tif err := cmd.Process.Kill(); err != nil {\n\t\t\t\tdriverLogger.Errorf(\"Failed to kill external driver process after socket wait timeout: %v\", err)\n\t\t\t}\n\t\t\t<-procExit\n\t\t\treturn errors.New(\"timed out waiting for external driver to create socket file\")\n\t\t}\n\t}\n}\n\n// Stop finds and stops any external driver server processes in the given\n// instance directory using PID files. If force is true, SIGKILL is sent;\n// otherwise SIGTERM is sent and we wait for the process to exit.\n// Also cleans up PID files and socket files.\nfunc Stop(instDir string, force bool) {\n\tlogrus.Debugf(\"Stopping external driver server in instance directory %s\", instDir)\n\tpidPattern := filepath.Join(instDir, \"*.drv.pid\")\n\tfiles, _ := filepath.Glob(pidPattern)","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/external/server/server.go#L246-L282","documentation":"Same wait-for-socket loop as above, but here the driver process exited with a non-nil waitErr (non-zero exit status or signal), so the error wraps that status: 'external driver process exited before creating socket file: <waitErr>'. The wrapped exit error is the real diagnostic — it usually carries the driver's exit code or the signal that killed it.","triggerScenarios":"The external driver binary crashes or is killed (non-zero exit/signal) before writing its socket — missing shared libraries, panic in the driver, exec format error, OOM kill, or the binary doesn't exist and cmd.Start failed differently than expected.","commonSituations":"Driver binary compiled for the wrong OS/arch; driver panics on an unsupported config field; system OOM killer terminates it; missing dynamic dependencies (e.g. missing libvirt/gvproxy-adjacent libs); corrupted download of the plugin.","solutions":["Read the wrapped exit code in the error and the driver's captured stderr to identify the crash cause","Run the driver binary directly to reproduce (e.g. missing .so -> install dependencies)","Re-download/rebuild the driver plugin for the correct platform","Check dmesg/journal for OOM or segfault reports at the failure time"],"exampleFix":"// before: binary for wrong arch exits with 'exec format error'\nexternal driver process exited before creating socket file: exit status 126\n// after: install the correct platform build\n$ file ~/.lima/drivers/mydriver/mydriver  # check arch\n$ limactl reinstall-driver mydriver --arch=$(uname -m)","handlingStrategy":"try-catch","validationCode":"// pre-check binary runs on this platform\nif runtime.GOOS != expectedDriverGOOS || runtime.GOARCH != expectedDriverGOARCH {\n\treturn fmt.Errorf(\"driver plugin built for wrong platform\")\n}","typeGuard":null,"tryCatchPattern":"if err := limactl.Start(inst); err != nil {\n\tvar exitErr *exec.ExitError\n\tif errors.As(err, &exitErr) {\n\t\tlog.Printf(\"driver crashed: code=%d\", exitErr.ExitCode())\n\t\t// reinstall plugin / check dmesg for OOM, then retry\n\t}\n\treturn err\n}","preventionTips":["Install driver plugins built for your exact OS/arch","Monitor host memory; OOM killer deaths surface here","Re-download plugins if a download may have been corrupted","Check system logs (dmesg/journal) after crashes for segfault causes"],"tags":["external-driver","process-crash","socket","startup"],"backgroundTag":"driver-exited-before-socket-ready","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}