rustdesk/rustdesk · critical

daemon.plist not found in embedded resources

Error message

daemon.plist not found in embedded resources

What it means

macOS service installation embeds daemon/agent launchd plists via `rust-embed` in `PRIVILEGES_SCRIPTS_DIR`. Before installing, the code fetches `daemon.plist` from the embedded bundle; if the asset is absent it bails with `daemon.plist not found in embedded resources`, meaning the binary was built without the required embedded resources.

Source

Thrown at src/platform/macos.rs:347

        Ok::<(), std::io::Error>(())
    })();
    if result.is_err() {
        let _ = std::fs::remove_file(&temporary);
    }
    result.map_err(Into::into)
}

pub fn write_plists() -> ResultType<()> {
    let daemon_plist_path = format!(
        "/Library/LaunchDaemons/com.carriez.{}_service.plist",
        crate::get_app_name()
    );
    let agent_plist_path = format!(
        "/Library/LaunchAgents/com.carriez.{}_server.plist",
        crate::get_app_name()
    );
    let Some(daemon_plist) = PRIVILEGES_SCRIPTS_DIR.get_file("daemon.plist") else {
        bail!("daemon.plist not found in embedded resources");
    };
    let Some(daemon_plist_body) = daemon_plist.contents_utf8().map(correct_app_name) else {
        bail!("Failed to read daemon.plist");
    };
    let Some(agent_plist) = PRIVILEGES_SCRIPTS_DIR.get_file("agent.plist") else {
        bail!("agent.plist not found in embedded resources");
    };
    let Some(agent_plist_body) = agent_plist.contents_utf8().map(correct_app_name) else {
        bail!("Failed to read agent.plist");
    };
    write_plist_atomically(&daemon_plist_path, &daemon_plist_body)?;
    write_plist_atomically(&agent_plist_path, &agent_plist_body)?;
    log::info!("[write-plists] Wrote daemon and agent plists");
    Ok(())
}

pub fn uninstall_service(show_new_window: bool, sync: bool) -> bool {
    // to-do: do together with win/linux about refactory start/stop service

View on GitHub (pinned to 91c9fccbb0)

Solutions

  1. Rebuild the app from a clean checkout so rust-embed picks up `daemon.plist` from the embedded folder.
  2. Verify the plist exists in the folder referenced by the `PRIVILEGES_SCRIPTS_DIR` `#[folder = ...]` attribute.
  3. Ensure your build/packaging pipeline doesn't strip or exclude resource files from the binary.
  4. Use official release binaries if you're running a locally patched build.

Example fix

// verify before install
if PRIVILEGES_SCRIPTS_DIR.get_file("daemon.plist").is_none() {
    return Err("build is missing embedded daemon.plist; rebuild required".into());
}
install_daemon()?;
Defensive patterns

Strategy: validation

Validate before calling

// at startup, before offering install/uninstall
if PRIVILEGES_SCRIPTS_DIR.get_file("daemon.plist").is_none()
    || PRIVILEGES_SCRIPTS_DIR.get_file("agent.plist").is_none() {
    log::error!("embedded launchd plists missing; rebuild with resources");
}

Try / catch

match install_me() {
    Err(e) if e.to_string().contains("daemon.plist not found") => {
        eprintln!("broken build: embedded daemon.plist missing; reinstall official app");
    }
    r => r?,
}

Prevention

When it happens

Trigger: Calling the macOS install/uninstall service flow on a binary where `PRIVILEGES_SCRIPTS_DIR.get_file("daemon.plist")` returns None — plist not present in the embedded directory at compile time, wrong `#[folder]` path, or a repackaged/stripped binary.

Common situations: Custom builds where `res/macOS/launchd` (or equivalent) files were deleted or renamed; building with a feature set that excludes the embedded dir; packaging scripts that rebuild the binary without re-embedding resources; app name mismatch after `correct_app_name` handling.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of rustdesk/rustdesk@91c9fccbb0 (2026-09-10). Data as JSON: /api/errors/ecd8601eced0075e. Report an issue: GitHub.