flxzt/rnote · error

Timeout reached

Error message

Timeout reached

What it means

run_thumbnail aborted because generating the thumbnail did not complete before the configured timeout elapsed. The engine's generate_thumbnail future is raced with a timeout via futures::select!, and the timeout branch returns this error.

Solutions

  1. Increase the thumbnail timeout (if configurable) or generate at a smaller size
  2. Pre-load the document and check stroke count before exporting thumbnails; skip or batch huge documents
  3. Retry once; if reproducible, profile the document and simplify it (e.g. flatten/split content)
Defensive patterns

Strategy: fallback

Validate before calling

let meta = std::fs::metadata(rnote_file)?;
if meta.len() > 100 * 1024 * 1024 {
    eprintln!("Document too large for quick thumbnail; expect timeout");
}

Try / catch

match result {
    Err(e) if e.to_string().contains("Timeout reached") => {
        eprintln!("Thumbnail generation timed out; try smaller size or skip preview");
        // fall back to a placeholder thumbnail
    }
    other => other,
}

Prevention

When it happens

Trigger: Generating a thumbnail for a very large or pathologically complex document where the render takes longer than the timeout duration, or a stalled engine task.

Common situations: Huge .rnote files with thousands of strokes; running on very slow/loaded machines or in CI where rendering is slow.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of flxzt/rnote@bbc5354502 (2026-09-08). Data as JSON: /api/errors/5f7fbfe099e4c042. Report an issue: GitHub.

Appendix: source

Thrown at crates/rnote-cli/src/thumbnail.rs:39

    let mut rnote_file_bytes = vec![];

    let mut fh = File::open(rnote_file).await?;
    fh.read_to_end(&mut rnote_file_bytes).await?;
    let engine_snapshot = EngineSnapshot::load_from_rnote_bytes(rnote_file_bytes).await?;

    // We dont care about the return values of these functions
    let _ = engine.load_snapshot(engine_snapshot);
    let mut timeout = if let Some(timeout) = timeout {
        Timer::after(timeout).fuse()
    } else {
        Timer::never().fuse()
    };
    let mut export_op = engine
        .generate_thumbnail(size, SelectionExportFormat::Png)
        .fuse();
    let export_bytes = select! {
        res = export_op => res??.context("Generating thumbnail failed, empty document.")?,
        _ = timeout => return Err(anyhow!("Timeout reached"))
    };
    let mut fh = File::create(output).await?;
    fh.write_all(&export_bytes).await?;
    fh.sync_all().await?;

    Ok(())
}

View on GitHub (pinned to bbc5354502)