vectordotdev/vector · error
Failed to create output dir
Error message
Failed to create output dir: {new_dir:?} What it means
After computing the mirrored output subdirectory name, the walker creates it with fs::create_dir_all; failure panics with 'Failed to create output dir: <path>'. This mirrors the input directory structure into the output root.
Solutions
- Ensure the output root exists and is writable; remove conflicting regular files that block directory creation
- Run with a user/group that has write permission on the output tree, or chown the output root
- Shorten paths by using a shallower output root if PATH_MAX is the issue (use a path under a short tmpdir)
- Patch to push the io::Error into the errors Vec rather than panicking
Example fix
// before
fs::create_dir_all(&new_dir)
.unwrap_or_else(|_| panic!("Failed to create output dir: {new_dir:?}"));
// after
if let Err(err) = fs::create_dir_all(&new_dir) {
errors.push(format!("Failed to create output dir {new_dir:?}: {err}"));
continue;
} Defensive patterns
Strategy: validation
Validate before calling
fn ensure_writable_dir(p: &std::path::Path) -> std::io::Result<()> {
std::fs::create_dir_all(p)?;
let probe = p.join(".write_probe");
std::fs::write(&probe, b"")?;
std::fs::remove_file(&probe)
} Type guard
fn is_writable_dir(p: &std::path::Path) -> bool { p.is_dir() && !fs::metadata(p).map(|m| m.permissions().readonly()).unwrap_or(true) } Prevention
- Pre-create and permission-check the output root before running
- Use a short output root to stay under PATH_MAX for deep trees
- Ensure no output component collides with an existing file
When it happens
Trigger: create_dir_all fails for the mirrored subdirectory: parent output dir is read-only, a same-named path component already exists as a regular file, path length limits are exceeded, or the disk is full.
Common situations: Reusing an output root that partially contains files where directories are expected, running as a user without write access to the output tree, or very deep input trees hitting PATH_MAX on Linux.
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 create output dir(s)
- Failed to bind to listener socket at path
- Failed to get entry for dir
- Failed to get extension for
- Failed to get file_name for
AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16).
Data as JSON: /api/errors/26a1f8b330cd1472.
Report an issue: GitHub.
Appendix: source
Thrown at src/convert_config.rs:168
) -> Result<(), Vec<String>> {
let mut errors = Vec::new();
if input_path.is_dir() {
for entry in fs::read_dir(input_path)
.unwrap_or_else(|_| panic!("Failed to read dir: {input_path:?}"))
{
let entry_path = entry
.unwrap_or_else(|_| panic!("Failed to get entry for dir: {input_path:?}"))
.path();
let new_output_dir = if entry_path.is_dir() {
let last_component = entry_path
.file_name()
.unwrap_or_else(|| panic!("Failed to get file_name for {entry_path:?}"));
let new_dir = output_dir.join(last_component);
if !new_dir.exists() {
fs::create_dir_all(&new_dir)
.unwrap_or_else(|_| panic!("Failed to create output dir: {new_dir:?}"));
}
new_dir
} else {
output_dir.to_path_buf()
};
if let Err(new_errors) = walk_dir_and_convert(
&input_path.join(&entry_path),
&new_output_dir,
output_format,
) {
errors.extend(new_errors);
}
}
} else {
let output_path = output_dir.join(
input_path
.with_extension(output_format.to_string().as_str())View on GitHub (pinned to bdb87aeaa4)