biomejs/biome · error

Failed to create log file

Error message

Failed to create log file

What it means

Error "Failed to create log file" thrown in biomejs/biome.

Source

Thrown at crates/biome_cli/src/logging.rs:95

    file: Option<&str>,
    level: LoggingLevel,
    kind: LoggingKind,
    colors: Option<&ColorsArg>,
) {
    use tracing_subscriber_ext::*;

    if level == LoggingLevel::None {
        return;
    }

    let fmt_span = matches!(level, LoggingLevel::Tracing)
        .then_some(FmtSpan::CLOSE)
        .unwrap_or(FmtSpan::NONE);

    let make_writer = file
        .map(File::create)
        .transpose()
        .expect("Failed to create log file")
        .optional()
        .or_else(std::io::stdout);

    let layer = tracing_subscriber::fmt::layer()
        .with_level(true)
        .with_target(false)
        .with_thread_names(true)
        .with_file(true)
        .with_ansi(colors.is_none_or(|c| c.is_enabled()))
        .with_span_events(fmt_span)
        .with_writer(make_writer);

    let registry = registry();
    let filter = LoggingFilter { level };
    match kind {
        LoggingKind::Pretty => registry.with(layer.pretty().with_filter(filter)).init(),
        LoggingKind::Compact => registry.with(layer.compact().with_filter(filter)).init(),
        LoggingKind::Json => registry

View on GitHub (pinned to 45a19bbf17)

Solutions

  1. Ensure the parent directory of the log file exists and the process has permission to create files there.
  2. Verify no other process holds an exclusive lock on the log file.

Example fix

std::fs::create_dir_all(path.parent().unwrap())?; let file = std::fs::File::create(path)?;

When it happens

Trigger: Thrown at crates/biome_cli/src/logging.rs:95 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of biomejs/biome@45a19bbf17 (2026-08-20). Data as JSON: /api/errors/47d3383551ae395c. Report an issue: GitHub.