tinyhumansai/openhuman · error · anyhow::Error
Failed to read image file: {e}
Error message
Failed to read image file: {e} What it means
Wrapped IO error in image_info: tokio::fs::read failed while loading the image bytes, after metadata succeeded and the size check passed. {e} is the OS-level read error (permissions changed, file removed mid-flight, I/O error).
Source
Thrown at src/openhuman/tools/impl/browser/image_info.rs:178
Ok(p) => p,
Err(msg) => return Ok(ToolResult::error(msg)),
};
let metadata = tokio::fs::metadata(&resolved)
.await
.map_err(|e| anyhow::anyhow!("Failed to read file metadata: {e}"))?;
let file_size = metadata.len();
if file_size > MAX_IMAGE_BYTES {
return Ok(ToolResult::error(format!(
"Image too large: {file_size} bytes (max {MAX_IMAGE_BYTES} bytes)"
)));
}
let bytes = tokio::fs::read(&resolved)
.await
.map_err(|e| anyhow::anyhow!("Failed to read image file: {e}"))?;
let format = Self::detect_format(&bytes);
let dimensions = Self::extract_dimensions(&bytes, format);
let mut output = format!("File: {path_str}\nFormat: {format}\nSize: {file_size} bytes");
if let Some((w, h)) = dimensions {
let _ = write!(output, "\nDimensions: {w}x{h}");
}
if include_base64 {
use base64::Engine;
let encoded = base64::engine::general_purpose::STANDARD.encode(&bytes);
let mime = match format {
"png" => "image/png",
"jpeg" => "image/jpeg",
"gif" => "image/gif",
"webp" => "image/webp",View on GitHub (pinned to 7491200858)
Solutions
- Confirm the file is still present and readable
- Check {e} for the OS error cause
- Retry after fixing permissions or the file state
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src/openhuman/tools/impl/browser/image_info.rs:178 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17).
Data as JSON: /api/errors/1643dd241c416467.
Report an issue: GitHub.