tracel-ai/burn · error

The path '{}' to point to a file.

Error message

The path '{}' to point to a file.

What it means

Guard panic in `FileApplicationLoggerInstaller::install`: the configured log path has no file-name component (e.g., it points at a directory root like `/` or `.`), so `path.file_name()` returns None and `tracing_appender` cannot derive a log file to write to.

Source

Thrown at crates/burn-train/src/learner/application_logger.rs:33

    path: PathBuf,
}

impl FileApplicationLoggerInstaller {
    /// Create a new file application logger.
    pub fn new(path: impl AsRef<Path>) -> Self {
        Self {
            path: path.as_ref().to_path_buf(),
        }
    }
}

impl ApplicationLoggerInstaller for FileApplicationLoggerInstaller {
    fn install(&self) -> Result<(), String> {
        let path = Path::new(&self.path);
        let writer = tracing_appender::rolling::never(
            path.parent().unwrap_or_else(|| Path::new(".")),
            path.file_name().unwrap_or_else(|| {
                panic!("The path '{}' to point to a file.", self.path.display())
            }),
        );
        let layer = tracing_subscriber::fmt::layer()
            .with_ansi(false)
            .with_writer(writer)
            .with_filter(LevelFilter::INFO)
            .with_filter(filter_fn(|m| {
                if let Some(path) = m.module_path() {
                    // The wgpu crate is logging too much, so we skip `info` level.
                    if path.starts_with("wgpu") && *m.level() >= Level::INFO {
                        return false;
                    }
                }
                true
            }));

        if registry().with(layer).try_init().is_err() {
            return Err("Failed to install the file logger.".to_string());

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Pass a path that includes a file name, e.g. `/var/log/train.log` instead of `/var/log/`
  2. Check the path with `Path::file_name()` before constructing the installer
  3. Create the parent directory first if it does not exist
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/burn-train/src/learner/application_logger.rs:33 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05). Data as JSON: /api/errors/6f3daf0e1eb455c3. Report an issue: GitHub.