cloudflare/quiche · error

failed to open file

Error message

failed to open file

What it means

h3i's read_qlog opens the qlog file with std::fs::File::open and panics with this message if opening fails. It is used to replay recorded qlog events into h3i actions, so a missing or unreadable path aborts the whole run.

Solutions

  1. Verify the qlog file path exists and is readable (ls -l <file>).
  2. Pass the correct absolute path to the qlog input file.
  3. Fix file permissions (chmod/chown) or run from the directory containing the qlog.

Example fix

// before
h3i --qlog-input qlog/trace.qlog
// after (verify first)
ls -l qlog/trace.qlog && h3i --qlog-input ./qlog/trace.qlog
Defensive patterns

Strategy: validation

Validate before calling

use std::path::Path;
if !Path::new(filename).is_file() {
    eprintln!("qlog input not found: {filename}");
    std::process::exit(1);
}

Try / catch

std::fs::File::open(filename)
    .map_err(|e| { eprintln!("failed to open qlog {filename}: {e}"); std::process::exit(1); })

Prevention

When it happens

Trigger: Passing a --qlog-input filename that does not exist, is a directory, or is not readable by the current user.

Common situations: Typoed path; qlog file written to another directory; running in a container without the file mounted; permission issues after a sudo-generated qlog.

Understand the failure class

Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.

Related errors


AI-assisted analysis of cloudflare/quiche@9f96daa2c2 (2026-09-08). Data as JSON: /api/errors/760af622e06cfbfc. Report an issue: GitHub.

Appendix: source

Thrown at h3i/src/main.rs:377

        )
        .await
        .unwrap()
        .await
    };

    Ok(rt.block_on(fut))
}

#[cfg(not(feature = "async"))]
fn sync_client(
    config: Config, actions: Vec<Action>,
) -> Result<ConnectionSummary, ClientError> {
    // TODO: CLI/qlog don't support passing close trigger frames at the moment
    h3i::client::sync_client::connect(config.library_config, actions, None)
}

fn read_qlog(filename: &str, host_override: Option<&str>) -> Vec<Action> {
    let file = std::fs::File::open(filename).expect("failed to open file");
    let reader = BufReader::new(file);

    let qlog_reader = QlogSeqReader::new(Box::new(reader)).unwrap();
    let mut actions = vec![];

    for event in qlog_reader {
        match event {
            qlog::reader::Event::Qlog(ev) => {
                let ac: H3Actions = actions_from_qlog(ev, host_override);
                actions.extend(ac.0);
            },

            qlog::reader::Event::Json(ev) => {
                let ac: H3Actions = (ev).into();
                actions.extend(ac.0);
            },
        }
    }

View on GitHub (pinned to 9f96daa2c2)