{"record":{"id":"90a516d02aa0ce15","repo":"espanso/espanso","slug":"unable-to-start-ipc-handler","errorCode":null,"errorMessage":"unable to start IPC handler","messagePattern":"unable to start IPC handler","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"espanso/src/cli/daemon/ipc.rs","lineNumber":54,"sourceCode":"                .run(Box::new(move |event| match event {\n                    IPCEvent::Exit => {\n                        if let Err(err) = exit_notify.send(DAEMON_SUCCESS) {\n                            error!(\n                \"experienced error while sending exit signal from daemon ipc handler: {err}\"\n              );\n                        }\n\n                        EventHandlerResponse::NoResponse\n                    }\n                    unexpected_event => {\n                        warn!(\n                            \"received unexpected event in daemon ipc handler: {unexpected_event:?}\"\n                        );\n\n                        EventHandlerResponse::NoResponse\n                    }\n                }))\n                .expect(\"unable to start IPC handler\");\n        })?;\n\n    Ok(())\n}\n","sourceCodeStart":36,"sourceCodeEnd":59,"githubUrl":"https://github.com/espanso/espanso/blob/e6c3736675048026a057f1c4803d59242482fa7b/espanso/src/cli/daemon/ipc.rs#L36-L59","documentation":"initialize_and_spawn spawns a 'daemon-ipc-handler' thread whose body calls server.run(handler). If run fails to start serving IPC requests, the expect panics inside that thread with this message, so the daemon's IPC endpoint never comes up even though initialize_and_spawn itself returned Ok.","triggerScenarios":"IPCServer::run returns Err while starting to accept connections: the IPC transport (socket/pipe) is unusable at run time, the handler channel binding fails, or runtime resources were invalidated between server creation and run.","commonSituations":"Runtime dir/socket removed after server creation, IPC transport not supported in the sandbox/container, OS-level socket errors during accept setup.","solutions":["Ensure the runtime directory (and socket file) are not deleted while the daemon runs","Check that the sandbox/container permits Unix socket listen/accept operations","Restart the daemon so the IPC server is recreated cleanly","Wrap server.run with error logging instead of expect so the failure is visible in logs"],"exampleFix":"// before\n.expect(\"unable to start IPC handler\");\n// after\nif let Err(err) = server.run(Box::new(move |event| { /* ... */ })) {\n    error!(\"unable to start IPC handler: {err}\");\n}","handlingStrategy":"try-catch","validationCode":"if !runtime_dir.is_dir() {\n    eprintln!(\"runtime dir vanished before IPC handler start\");\n}","typeGuard":null,"tryCatchPattern":"if let Err(err) = server.run(Box::new(handler)) {\n    error!(\"IPC handler failed to start: {err}\");\n    exit_notify.send(WORKER_ERROR_EXIT_NO_CODE);\n}","preventionTips":["Do not remove runtime dir/socket while the daemon is up","Verify sandbox allows socket listen/accept","Watch daemon logs for IPC startup errors"],"tags":["ipc","thread","server"],"backgroundTag":"module-init-failed","analyzedSha":"e6c3736675048026a057f1c4803d59242482fa7b","analyzedAt":"2026-09-06T15:16:34.240Z","contentChangedAt":"2026-09-06T15:16:34.240Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}