can1357/oh-my-pi · error · ToolError
${error.message}
Error message
${error.message} What it means
While loading the image (file, SVG, or attachment), an ImageInputTooLargeError was raised because the image exceeds MAX_IMAGE_INPUT_BYTES. The tool converts it to a ToolError carrying the original message (which includes size limits and the actual size). This is a pre-flight guard so oversized images never reach the provider.
Source
Thrown at packages/coding-agent/src/tools/inspect-image.ts:244
imageInput = await loadSvgImageInput({
path: imageTarget.path,
cwd: this.session.cwd,
autoResize,
maxBytes: MAX_IMAGE_INPUT_BYTES,
excludeWebP,
});
} else {
imageInput = await loadImageInput({
path: params.path,
cwd: this.session.cwd,
autoResize,
maxBytes: MAX_IMAGE_INPUT_BYTES,
excludeWebP,
});
}
} catch (error) {
if (error instanceof ImageInputTooLargeError) {
throw new ToolError(error.message);
}
throw error;
}
if (!imageInput) {
throw new ToolError(
isSvgImage
? "inspect_image ':img' only supports .svg and .svgz files."
: "inspect_image only supports PNG, JPEG, GIF, and WEBP files detected by file content.",
);
}
const telemetry = resolveTelemetry(this.session.getTelemetry?.(), this.session.getSessionId?.() ?? undefined);
const timeoutMs = this.session.settings.get("inspect_image.timeoutMs");
const hasTimeout = typeof timeoutMs === "number" && Number.isFinite(timeoutMs) && timeoutMs > 0;
const timeoutSignal = hasTimeout ? AbortSignal.timeout(timeoutMs) : undefined;
const effectiveSignal = timeoutSignal
? signalView on GitHub (pinned to 9690622007)
Solutions
- Shrink or recompress the image before inspecting (resize dimensions, export as JPEG).
- Enable images.autoResize=true so the tool downscales automatically.
- Crop the image to the relevant region to cut bytes.
- For SVGs, simplify or reduce raster resolution of the ':img' render.
Example fix
// before: raw 12MB screenshot
inspect_image({ path: "screen.png", ... })
// after
// $ magick screen.png -resize 1600x screen-small.jpg
inspect_image({ path: "screen-small.jpg", ... }) Defensive patterns
Strategy: validation
Validate before calling
import { statSync } from "node:fs";
const size = statSync(imagePath).size;
if (size > MAX_IMAGE_INPUT_BYTES) {
// downscale/compress or crop the image before inspecting
} Try / catch
try {
await inspectImageTool.execute(id, params, signal);
} catch (e) {
if (e instanceof ToolError && /too large|bytes/i.test(e.message)) {
// resize/re-encode the image and retry once
} else throw e;
} Prevention
- Keep images.autoResize enabled so large images are downscaled automatically.
- Pre-compress screenshots/photos before pointing the agent at them.
- For SVGs, keep them simple or lower the raster resolution used by ':img'.
When it happens
Trigger: Calling inspect_image with an image file/attachment whose encoded size exceeds MAX_IMAGE_INPUT_BYTES even after optional auto-resize (images.autoResize setting) — e.g. huge screenshots, high-res photos, or large SVGs (with :img) that rasterize past the cap.
Common situations: Inspecting 4K/full-page screenshots; photos from cameras; dense SVG diagrams rasterized at high DPI; autoResize disabled so no downscaling is attempted.
Related errors
- Image file too large: ${formatBytes(inputBytes)} exceeds ${f
- Unknown image type: ${mimeType}
- Managed skill is ${bytes} bytes; the limit is ${MAX_MANAGED_
- ${name} exceeds the ${SHARPSHOOTER_MAX_FILE_LINES}-line limi
- inspect_image ':img' only supports .svg and .svgz files. / i
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/76ad2dbbda2e6c4a.
Report an issue: GitHub.