zed-industries/zed · error

No log file path configured

Error message

No log file path configured

What it means

Returned by rotate_log_file when path_rotate is configured (rotation requested) but the main log file path is None. Rotation requires a primary log file to rotate; with no base path configured the log sink setup fails with this sentinel.

Source

Thrown at crates/zlog/src/sink.rs:270

        if self.ansi {
            f.write_str(ANSI_RESET)?;
        }
        f.write_char(']')?;
        Ok(())
    }
}

fn rotate_log_file<PathRef>(
    path: Option<PathRef>,
    path_rotate: Option<PathRef>,
) -> std::io::Result<Option<fs::File>>
where
    PathRef: AsRef<std::path::Path>,
{
    let path = path.as_ref().map(PathRef::as_ref);
    let rotation_error = match (path, path_rotate) {
        (Some(_), None) => Some(anyhow::anyhow!("No rotation log file path configured")),
        (None, _) => Some(anyhow::anyhow!("No log file path configured")),
        (Some(path), Some(path_rotate)) => fs::copy(path, path_rotate)
            .err()
            .map(|err| anyhow::anyhow!(err)),
    };
    if let Some(err) = rotation_error {
        eprintln!("Log file rotation failed. Truncating log file anyways: {err}",);
    }
    path.map(|path| {
        fs::OpenOptions::new()
            .create(true)
            .write(true)
            .truncate(true)
            .open(path)
    })
    .transpose()
}

#[cfg(test)]

View on GitHub (pinned to f4178619ac)

Solutions

  1. Provide a log file path before enabling file logging
  2. Treat missing path as 'no file sink' and continue with other sinks
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zlog/src/sink.rs:270 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/ca57ab0b630992c2. Report an issue: GitHub.