{"record":{"id":"d43e5dd64a021258","repo":"AlexsJones/llmfit","slug":"warning-could-not-save-result-locally-e","errorCode":null,"errorMessage":"Warning: could not save result locally: {e}","messagePattern":"Warning: could not save result locally: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"llmfit-tui/src/tui_app.rs","lineNumber":511,"sourceCode":"\n    // Always record the run locally; sharing (now or later) uploads from the\n    // pending store, so declining to share never discards the result.\n    let store_err = share::store_local(std::slice::from_ref(&result), specs).err();\n\n    let Some(token) = share_token else {\n        let mut note = share_note.unwrap_or_default();\n        if !note.is_empty() {\n            note.push(' ');\n        }\n        match store_err {\n            None => {\n                let pending = share::pending_benchmarks().len();\n                note.push_str(&format!(\n                    \"Saved locally ({pending} pending) — share any time with \\\n                     `llmfit bench --share`.\"\n                ));\n            }\n            Some(e) => note.push_str(&format!(\"Warning: could not save result locally: {e}\")),\n        }\n        let _ = tx.send(BenchOfferMsg::Done {\n            summary,\n            pr_url: None,\n            share_note: Some(note),\n        });\n        return;\n    };\n\n    // Upload the entire pending store: this run plus anything stored earlier.\n    let stored = share::pending_benchmarks();\n    let _ = tx.send(BenchOfferMsg::Progress(format!(\n        \"Opening pull request on GitHub ({} submission(s))...\",\n        stored.len()\n    )));\n    match share::submit_stored(&stored, &token) {\n        Ok(outcome) => {\n            share::mark_shared(&stored);","sourceCodeStart":493,"sourceCodeEnd":529,"githubUrl":"https://github.com/AlexsJones/llmfit/blob/1e7bdb3ecf43071597ffd2eb2305dfac35e22a40/llmfit-tui/src/tui_app.rs#L493-L529","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the target directory: on Linux `ls -ld ~/.local/share/llmfit/benchmarks/pending` — create it and fix ownership/permissions if missing.","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.","Ensure HOME (or XDG_DATA_HOME on Linux) is defined in service/container sessions where llmfit runs.","Free disk space on the volume hosting the data directory if writes fail with ENOSPC.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before benchmarking, confirm the pending store is creatable and writable.\nfn bench_store_writable() -> bool {\n    let root = std::env::var(\"LLMFIT_BENCH_STORE\").ok().filter(|s| !s.trim().is_empty())\n        .map(std::path::PathBuf::from)\n        .or_else(|| dirs::data_local_dir().map(|d| d.join(\"llmfit\").join(\"benchmarks\")));\n    let Some(root) = root else { return false };\n    let probe = root.join(\"pending\").join(\".probe\");\n    std::fs::create_dir_all(root.join(\"pending\")).is_ok()\n        && std::fs::write(&probe, b\"\").is_ok()\n        && std::fs::remove_file(&probe).is_ok()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set LLMFIT_BENCH_STORE to a known writable path in containers/CI and verify with a touch probe before running benches.","Ensure HOME or XDG_DATA_HOME is defined for service accounts running llmfit.","Periodically check disk space on the data volume — large model downloads share it with the benchmark store.","If the warning appears, re-run the benchmark after fixing the store; results are only lost when not persisted."],"tags":["filesystem","permissions","disk-full","benchmark-store","warning"],"backgroundTag":"app-data-dir-not-writable","analyzedSha":"1e7bdb3ecf43071597ffd2eb2305dfac35e22a40","analyzedAt":"2026-08-17T10:35:29.658Z","contentChangedAt":"2026-08-17T10:35:29.658Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}