rustdesk/rustdesk · error
Failed to create parent directory {:?} when staging custom c
Error message
Failed to create parent directory {:?} when staging custom client files: {} What it means
Before copying `custom.txt` into the staging directory, the code ensures the staging directory exists with `std::fs::create_dir_all`. Failure to create it aborts the update with this error, which includes the target directory and the underlying io::Error.
Source
Thrown at src/platform/windows.rs:3849
"Failed to read metadata for custom.txt at {:?}: {}",
src_path,
e
);
}
};
if metadata.is_symlink() {
allow_err!(remove_custom_client_staging_dir(&custom_client_staging_dir));
bail!(
"custom.txt at {:?} is a symlink, refusing to stage for security reasons.",
src_path
);
}
if metadata.is_file() {
if !custom_client_staging_dir.exists() {
if let Err(e) = std::fs::create_dir_all(custom_client_staging_dir) {
bail!("Failed to create parent directory {:?} when staging custom client files: {}", custom_client_staging_dir, e);
}
}
let dst_path = custom_client_staging_dir.join("custom.txt");
if let Err(e) = std::fs::copy(&src_path, &dst_path) {
allow_err!(remove_custom_client_staging_dir(&custom_client_staging_dir));
bail!(
"Failed to copy custom txt from {:?} to {:?}: {}",
src_path,
dst_path,
e
);
}
} else {
log::warn!(
"custom.txt at {:?} is not a regular file, skipping.",
src_path
);
}View on GitHub (pinned to 91c9fccbb0)
Solutions
- Check for a file (not directory) sitting at the staging path and remove it
- Run the update elevated / fix ACLs on the staging root directory
- Shorten the path or move the staging root if MAX_PATH or invalid characters are involved
Defensive patterns
Strategy: try-catch
Validate before calling
if !staging_dir.exists() {
// ensure parent chain is creatable and no file blocks the path
if let Some(parent) = staging_dir.parent() {
assert!(std::fs::metadata(parent).map(|m| m.is_dir()).unwrap_or(false));
}
} Try / catch
if let Err(e) = std::fs::create_dir_all(&staging_dir) {
if e.kind() == std::io::ErrorKind::PermissionDenied {
// request elevation or choose another staging root
}
} Prevention
- Check no regular file occupies the staging directory path
- Run updates from an account with write access to the staging root
- Watch for MAX_PATH problems on deeply nested staging roots
When it happens
Trigger: `custom.txt` is a regular file and the staging directory does not exist, but `create_dir_all` fails — path is invalid/too long, access denied under the staging root, or a file exists where a directory component is expected.
Common situations: Staging root on a read-only or admin-only location; a stray file occupying the directory path; MAX_PATH issues; antivirus blocking directory creation.
Understand the failure class
Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.
Related errors
- failed to mkdir ipc parent dir: postfix={}, parent={}, err={
- Failed to inspect ACL target directory '{}': {}
- ACL target is not a directory: '{}'
- Failed to inspect ACL target '{}': {}
- Failed to inspect portable service shared-memory ACL directo
AI-assisted analysis of rustdesk/rustdesk@91c9fccbb0 (2026-09-10).
Data as JSON: /api/errors/acf76bc421633faf.
Report an issue: GitHub.