Hmbown/CodeWhale · error
serialized lane exit receipt exceeds size bound
Error message
serialized lane exit receipt exceeds size bound
What it means
write_lane_exit_receipt serializes the LaneExitReceipt (lane id plus exit code) and refuses to write if the JSON exceeds MAX_EXIT_RECEIPT_BYTES. The receipt is a fixed-shape tiny document, so exceeding the bound signals an internal invariant violation rather than user input.
Solutions
- Shorten/normalize lane_id so the serialized receipt fits the bound.
- If LaneExitReceipt legitimately grew, raise MAX_EXIT_RECEIPT_BYTES in the source.
- Audit where lane_id is generated and cap its length at creation.
Example fix
// before
let lane_id = format!("lane-{}", huge_user_string);
// after
let lane_id = format!("lane-{}", hash_or_truncated_id); Defensive patterns
Strategy: try-catch
Validate before calling
let encoded = serde_json::to_vec(&receipt)?; assert!(encoded.len() as u64 <= MAX_EXIT_RECEIPT_BYTES);
Try / catch
// this indicates an invariant bug: log lane_id length and the bound, then report
if e.to_string().contains("exit receipt exceeds size bound") { log::error!("receipt overflow: lane_id len={}", lane_id.len()); } Prevention
- Bound lane_id length at creation time.
- If extending LaneExitReceipt, revisit MAX_EXIT_RECEIPT_BYTES in the same change.
- Add a unit test asserting a maximal lane_id serializes under the bound.
When it happens
Trigger: run_lane_log_proxy writing an exit receipt whose serialized form exceeds MAX_EXIT_RECEIPT_BYTES — realistically only if lane_id is enormous or the struct/serializer changed.
Common situations: Lane ids built from unbounded user input; a code change adding fields to LaneExitReceipt without revisiting the byte bound.
Understand the failure class
Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.
Related errors
- lane exit receipt exceeds bytes
- active plugin registry is missing its pre-dotenv…
- bounded provider catalog cache exceeds its write limit
- bounded to model output cap
- bundle at is bytes; the limit is bytes
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/3c007f350d076273.
Report an issue: GitHub.
Appendix: source
Thrown at crates/lane/src/runtime.rs:378
bail!("invalid lane environment key {key:?}");
}
}
Ok(environment)
}
fn write_lane_exit_receipt(
receipt_path: &Path,
receipt_tmp_path: &Path,
lane_id: &str,
exit_code: i32,
) -> Result<()> {
let encoded = serde_json::to_vec(&LaneExitReceipt {
lane_id: lane_id.to_string(),
exit_code,
})
.context("serialize lane exit receipt")?;
if encoded.len() as u64 > MAX_EXIT_RECEIPT_BYTES {
bail!("serialized lane exit receipt exceeds size bound");
}
remove_file_if_present(receipt_tmp_path)?;
let mut options = OpenOptions::new();
options.create_new(true).write(true);
#[cfg(unix)]
{
use std::os::unix::fs::OpenOptionsExt;
options.mode(0o600);
}
let result = (|| {
let mut file = options
.open(receipt_tmp_path)
.with_context(|| format!("create {}", receipt_tmp_path.display()))?;
file.write_all(&encoded)
.with_context(|| format!("write {}", receipt_tmp_path.display()))?;
file.sync_all()
.with_context(|| format!("sync {}", receipt_tmp_path.display()))?;
fs::rename(receipt_tmp_path, receipt_path)View on GitHub (pinned to 73e0f67d83)