tursodatabase/turso · critical
invalid cell payload
Error message
invalid cell payload
What it means
After building the replacement interior cell payload (4-byte big-endian left-child pointer followed by the key), the parent update parses cell_payload[..4] back into a page number with try_into().expect("invalid cell payload"). The panic fires when the freshly built payload is shorter than 4 bytes, which the builders (child_pointer.to_be_bytes() extension) should never produce.
Solutions
- Report to Turso with the exact DELETE statement and a copy of the database - payload construction cannot legitimately produce <4 bytes
- Run PRAGMA integrity_check to rule out corruption
- Retry the operation on a fresh connection; pre-commit disk state is unaffected
- Upgrade the engine - the cell-building code paths are under active development
Defensive patterns
Strategy: try-catch
Try / catch
let result = std::panic::catch_unwind(AssertUnwindSafe(|| {
conn.execute("DELETE FROM idx_t ON ...", ()) // any delete touching interior cells
}));
if result.is_err() { conn.close().ok(); /* reopen, verify, report */ } Prevention
- Run PRAGMA integrity_check after abnormal terminations before further writes
- Test upgrades against delete-heavy datasets to catch serialization regressions early
- Use transactions around deletes so partial effects are never committed after a panic
- Report minimal reproductions upstream
When it happens
Trigger: Interior-node replacement on DELETE where the payload Vec came out empty or truncated - a logic bug in the payload construction arms (TableLeafCell / IndexLeafCell rewriting) or an allocation failure swallowed earlier in the chain.
Common situations: Engine regressions in cell serialization, corrupted cell metadata producing zero-length writes, allocation-failure paths in with_btree_allocation_site! macros.
Related errors
- ancestor page should be on the stack
- parent page should be on the stack
- post_balancing_seek_key should be Some
- there should be a pointer
- has_record=true but record() returned None
AI-assisted analysis of tursodatabase/turso@8d4a589f8d (2026-08-20).
Data as JSON: /api/errors/55a365b05ede7f06.
Report an issue: GitHub.
Appendix: source
Thrown at core/storage/btree.rs:6825
let contents = page.get_contents();
let cell_idx = self.stack.current_cell_index();
let (payload, payload_size, first_overflow_page) =
contents.cell_read_payload_ptr(cell_idx as usize, self.payload_limits)?;
if let Some(next_page) = first_overflow_page {
return_if_io!(self.process_overflow_read(payload, next_page, payload_size))
} else {
let record = self
.get_immutable_record_or_create()?
.expect("record was allocated above");
record.invalidate();
crate::with_btree_allocation_site!(RecordPayload, record.start_serialization(payload))?;
};
Ok(IOResult::Done(self.reusable_immutable_record.as_ref()))
}
#[inline(always)]
fn record_payload(&mut self) -> IOResultOr<Option<&[u8]>> {
if self.needs_restore() {
return restore_record_payload(self);
}
if self.null_flag || !self.has_record() {
return Ok(IOResult::Done(None));
}
let noted = self.noted_payload;
if noted.size != 0 {
let size = noted.size as usize;
// A cell that keeps its whole payload on the page: the rowid
// read already found where it starts.
if size <= self.payload_limits.max_local_table {
let start = noted.start as usize;
let contents = self.stack.top_ref().get_contents();
if let Some(payload) = contents.payload_on_page(start, size) {
return Ok(IOResult::Done(Some(payload)));
}
}View on GitHub (pinned to 8d4a589f8d)