sinelaw/fresh · error
Chunked recovery data not found
Error message
Chunked recovery data not found
What it means
reconstruct_from_chunks calls read_chunked_content and requires Some(chunked_data); None means no chunked recovery data (chunk index) exists for the given id, so reconstruction cannot proceed. Thrown as io::ErrorKind::NotFound with this message to distinguish 'no data at all' from per-chunk file failures.
Solutions
- Confirm the id exists via list_entries before calling reconstruct_from_chunks.
- Point the recovery storage at the correct directory that contains the chunked data.
- Treat NotFound as 'nothing to recover' and fall back to the original file content instead of failing.
Example fix
// before
let content = storage.reconstruct_from_chunks(&id, &original)?;
// after
let content = match storage.reconstruct_from_chunks(&id, &original) {
Ok(c) => c,
Err(e) if e.kind() == io::ErrorKind::NotFound => fs::read(&original)?,
Err(e) => return Err(e),
}; Defensive patterns
Strategy: fallback
Validate before calling
if !storage.exists_chunked(&id) { return Ok(fs::read(original_file)?); } Type guard
fn has_recovery_data(storage: &RecoveryStorage, id: &str) -> bool { storage.read_chunked_content(id).map(|o| o.is_some()).unwrap_or(false) } Try / catch
let content = match storage.reconstruct_from_chunks(&id, &original) {
Ok(c) => c,
Err(e) if e.kind() == io::ErrorKind::NotFound => fs::read(&original)?,
Err(e) => return Err(e.into()),
}; Prevention
- Look up valid ids via list_entries before reconstruction; never hardcode ids
- Fall back to the untouched original file when no recovery data exists
- Point all sessions at the same recovery storage root
When it happens
Trigger: reconstruct_from_chunks(id, original_file) invoked with an id that has no stored chunk index — wrong id, entry already consumed/deleted, or the recovery store directory differs from the write-time one.
Common situations: Recovery flows run after the entry was already recovered once and cleaned up; tests or scripts hardcoding ids; mixing recovery directories between profiles/machines.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Chunk content not found
- Chunk file not found
- Metadata file exists but couldn't be read
- NotFound
- no such folder
AI-assisted analysis of sinelaw/fresh@67894ca546 (2026-09-13).
Data as JSON: /api/errors/a429f9c3cfa4bf59.
Report an issue: GitHub.
Appendix: source
Thrown at crates/fresh-editor/src/services/recovery/storage.rs:471
original_len: chunk_meta.original_len,
content,
});
}
Ok(Some(ChunkedRecoveryData::new(
index.original_size,
index.final_size,
chunks,
)))
}
/// Reconstruct full content from chunked recovery and original file
///
/// This reads the original file and applies the stored chunks to reconstruct
/// the full modified content.
pub fn reconstruct_from_chunks(&self, id: &str, original_file: &Path) -> io::Result<Vec<u8>> {
let chunked_data = self.read_chunked_content(id)?.ok_or_else(|| {
io::Error::new(io::ErrorKind::NotFound, "Chunked recovery data not found")
})?;
// Read original file
let original_content = fs::read(original_file)?;
tracing::debug!(
"reconstruct_from_chunks: original_file={:?}, file_size_on_disk={}, expected_original_size={}",
original_file,
original_content.len(),
chunked_data.original_size
);
// Verify original file size matches what we expected
if original_content.len() != chunked_data.original_size {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!(
"Original file size mismatch: expected {}, got {}",View on GitHub (pinned to 67894ca546)