xai-org/grok-build · error
byte budget exceeded: {new_total}/{MAX_TOTAL_BYTES} bytes in
Error message
byte budget exceeded: {new_total}/{MAX_TOTAL_BYTES} bytes in {ARTIFACT_DIR} What it means
Error "byte budget exceeded: {new_total}/{MAX_TOTAL_BYTES} bytes in {ARTIFACT_DIR}" thrown in xai-org/grok-build.
Source
Thrown at crates/codegen/xai-grok-tools/src/implementations/grok_build/web_fetch/artifact.rs:56
fn save_locked(dir: &Path, data: &[u8], extension: &str) -> anyhow::Result<PathBuf> {
let mut allocation = std::fs::OpenOptions::new()
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(dir.join(ALLOCATION_FILE))
.context("open allocation file")?;
allocation
.lock_exclusive()
.context("lock allocation file")?;
let (max_existing, total_bytes) = scan_artifacts(dir)?;
let number = reserve_number(&mut allocation, max_existing)?;
let new_total = total_bytes
.checked_add(u64::try_from(data.len()).context("artifact size exceeds u64")?)
.context("artifact byte count overflow")?;
if new_total > MAX_TOTAL_BYTES {
anyhow::bail!(
"byte budget exceeded: {new_total}/{MAX_TOTAL_BYTES} bytes in {ARTIFACT_DIR}"
);
}
let path = dir.join(format!("{number}.{extension}"));
let mut tmp = tempfile::NamedTempFile::new_in(dir).context("create temp file")?;
tmp.write_all(data).context("write temp file")?;
tmp.as_file().sync_all().context("fsync temp file")?;
tmp.persist_noclobber(&path)
.with_context(|| format!("persist to {}", path.display()))?;
Ok(path)
}
fn reserve_number(file: &mut std::fs::File, max_existing: u32) -> anyhow::Result<u32> {
let stored = read_reserved_number(file)?.unwrap_or(max_existing);
let next = stored
.max(max_existing)
.checked_add(1)View on GitHub (pinned to bc7f02eddd)
When it happens
Trigger: Thrown at crates/codegen/xai-grok-tools/src/implementations/grok_build/web_fetch/artifact.rs:56 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31).
Data as JSON: /api/errors/2f20de3fae9a1a20.
Report an issue: GitHub.