xai-org/grok-build · error
no encoded bytes to persist
Error message
no encoded bytes to persist
What it means
Error "no encoded bytes to persist" thrown in xai-org/grok-build.
Source
Thrown at crates/codegen/xai-grok-pager-render/src/prompt_images.rs:1342
// -------------------------------------------------------------------------
/// Persist image bytes into the session `images/` directory.
///
/// Creates the directory if it does not exist. Uses a UUID-v4 filename
/// to avoid collisions (two pastes of the same image are independent).
///
/// On success:
/// - Sets `img.session_image_path` to the written file.
/// - Leaves `img.source_path` unchanged as the original display path.
/// - Drops `encoded_bytes` from memory.
pub fn persist_to_session(
img: &mut PastedImage,
session_images_dir: &std::path::Path,
) -> anyhow::Result<()> {
let bytes = img
.encoded_bytes
.as_ref()
.ok_or_else(|| anyhow::anyhow!("no encoded bytes to persist"))?;
std::fs::create_dir_all(session_images_dir)?;
let ext = extension_for_mime(&img.mime_type);
let filename = format!("image-{}.{}", uuid::Uuid::new_v4(), ext);
let path = session_images_dir.join(&filename);
// Atomic write: a crash mid-write leaves no partially-written final file.
let tmp_path = path.with_extension(format!("{ext}.tmp"));
let write_result: anyhow::Result<()> = (|| {
use std::io::Write as _;
let mut f = std::fs::File::create(&tmp_path)?;
f.write_all(bytes)?;
f.sync_all()?;
drop(f);
std::fs::rename(&tmp_path, &path)?;
Ok(())
})();
if write_result.is_err() {View on GitHub (pinned to bc7f02eddd)
When it happens
Trigger: Thrown at crates/codegen/xai-grok-pager-render/src/prompt_images.rs:1342 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/37d5941176c17e4b.
Report an issue: GitHub.