AlexsJones/llmfit · warning

Warning: could not save result locally: {e}

Error message

Warning: could not save result locally: {e}

What it means

This is not a panic but a user-facing warning string appended to the bench completion note in the TUI (tui_app.rs:496-512) when share::store_local fails to persist the benchmark result. store_local (llmfit-core/src/share.rs:397-411) can fail with: 'no local data directory' (dirs::data_local_dir() returns None because HOME/XDG_DATA_HOME is unset on Linux), 'create <dir>: ...' or 'write <path>: ...' (permission denied, read-only volume, disk full, or an LLMFIT_BENCH_STORE override pointing somewhere unwritable), 'serialize failed: ...' (practically never), or 'no benchmark results to store' (empty input). The benchmark run itself succeeded and its summary is still shown; only the ready-to-upload pending record was lost.

Source

Thrown at llmfit-tui/src/tui_app.rs:511

    // Always record the run locally; sharing (now or later) uploads from the
    // pending store, so declining to share never discards the result.
    let store_err = share::store_local(std::slice::from_ref(&result), specs).err();

    let Some(token) = share_token else {
        let mut note = share_note.unwrap_or_default();
        if !note.is_empty() {
            note.push(' ');
        }
        match store_err {
            None => {
                let pending = share::pending_benchmarks().len();
                note.push_str(&format!(
                    "Saved locally ({pending} pending) — share any time with \
                     `llmfit bench --share`."
                ));
            }
            Some(e) => note.push_str(&format!("Warning: could not save result locally: {e}")),
        }
        let _ = tx.send(BenchOfferMsg::Done {
            summary,
            pr_url: None,
            share_note: Some(note),
        });
        return;
    };

    // Upload the entire pending store: this run plus anything stored earlier.
    let stored = share::pending_benchmarks();
    let _ = tx.send(BenchOfferMsg::Progress(format!(
        "Opening pull request on GitHub ({} submission(s))...",
        stored.len()
    )));
    match share::submit_stored(&stored, &token) {
        Ok(outcome) => {
            share::mark_shared(&stored);

View on GitHub (pinned to 1e7bdb3ecf)

Solutions

  1. Check the target directory: on Linux `ls -ld ~/.local/share/llmfit/benchmarks/pending` — create it and fix ownership/permissions if missing.
  2. If LLMFIT_BENCH_STORE is set in your shell, verify it points to an existing writable directory (`touch "$LLMFIT_BENCH_STORE/x"`), or unset it to fall back to the default data dir.
  3. Ensure HOME (or XDG_DATA_HOME on Linux) is defined in service/container sessions where llmfit runs.
  4. Free disk space on the volume hosting the data directory if writes fail with ENOSPC.
  5. Re-run the benchmark once fixed — the previous result was not stored and cannot be recovered, but new runs will persist and appear in `llmfit bench --share` pending counts.
Defensive patterns

Strategy: validation

Validate before calling

// Before benchmarking, confirm the pending store is creatable and writable.
fn bench_store_writable() -> bool {
    let root = std::env::var("LLMFIT_BENCH_STORE").ok().filter(|s| !s.trim().is_empty())
        .map(std::path::PathBuf::from)
        .or_else(|| dirs::data_local_dir().map(|d| d.join("llmfit").join("benchmarks")));
    let Some(root) = root else { return false };
    let probe = root.join("pending").join(".probe");
    std::fs::create_dir_all(root.join("pending")).is_ok()
        && std::fs::write(&probe, b"").is_ok()
        && std::fs::remove_file(&probe).is_ok()
}

Prevention

When it happens

Trigger: Completing a TUI benchmark run on a machine where ~/.local/share (Linux) or the equivalent data dir is not writable: running under a service account without HOME, inside a hardened container/sandbox, with a full disk, or with LLMFIT_BENCH_STORE exported to a read-only or nonexistent location that cannot be created.

Common situations: Containers and CI runners with minimal environments (no HOME, read-only rootfs); macOS/Windows permission-protected data directories; users overriding LLMFIT_BENCH_STORE to a shared volume that is unmounted; disks at capacity after large model downloads.

Related errors


AI-assisted analysis of AlexsJones/llmfit@1e7bdb3ecf (2026-08-17). Data as JSON: /api/errors/d43e5dd64a021258. Report an issue: GitHub.