zellij-org/zellij · error

could not daemonize the server process

Error message

could not daemonize the server process

What it means

Error "could not daemonize the server process" thrown in zellij-org/zellij.

Solutions

  1. Check that the server process can fork and detach (no conflicting session, writable socket dir).
  2. Run the server in the foreground to see the underlying error.

When it happens

Trigger: Occurs at zellij-server/src/lib.rs:869 when the operation fails: "could not daemonize the server process". Currently there is no defensive handling preventing or contextualizing this failure before it surfaces.

Common situations: Restricted environments (containers without proper init) can prevent daemonization.


AI-assisted analysis of zellij-org/zellij@e839bfffa5 (2026-08-19). Data as JSON: /api/errors/2cd3cd1636722b65. Report an issue: GitHub.

Appendix: source

Thrown at zellij-server/src/lib.rs:876

        // After clear, removing the client yields no stuck tokens.
        assert!(s.remove_client(1).is_empty());
    }
}

pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
    info!("Starting Zellij server!");

    #[cfg(unix)]
    {
        use nix::sys::stat::{umask, Mode};
        // preserve the current umask: read current value by setting to another mode, and then restoring it
        let current_umask = umask(Mode::all());
        umask(current_umask);
        daemonize::Daemonize::new()
            .working_directory(std::env::current_dir().unwrap())
            .umask(current_umask.bits() as u32)
            .start()
            .expect("could not daemonize the server process");
    }

    #[cfg(windows)]
    {
        // The server is spawned with CREATE_NEW_PROCESS_GROUP, which disables
        // Ctrl+C handling for the process.  Child processes inherit this
        // disabled state, so ConPTY children (shells, commands) would silently
        // ignore CTRL_C_EVENT signals.  Re-enable Ctrl+C here so that
        // descendants get the normal default handler (terminate on Ctrl+C).
        //
        use windows_sys::Win32::System::Console::SetConsoleCtrlHandler;
        unsafe {
            SetConsoleCtrlHandler(None, 0);
        }
    }

    start_server_impl(os_input, socket_path, true);
}

View on GitHub (pinned to e839bfffa5)