NousResearch/hermes-agent · error · Error
reference image too large
Error message
reference image too large
What it means
Error "reference image too large" thrown in NousResearch/hermes-agent.
Source
Thrown at apps/desktop/src/app/pet-generate/lib/read-reference-image.ts:22
const img = new Image()
return new Promise((resolve, reject) => {
img.onload = () => resolve(img)
img.onerror = () => reject(new Error('unreadable image'))
img.src = url
})
}
// Read an image file as a downscaled PNG data URL. We decode from an object URL
// (not readAsDataURL) so large files don't inflate into giant base64 strings
// before we scale them down for generation.
export async function readReferenceImage(
file: File,
max = 1024,
maxInputBytes = DEFAULT_MAX_INPUT_BYTES
): Promise<string> {
if (file.size > maxInputBytes) {
throw new Error('reference image too large')
}
const objectUrl = URL.createObjectURL(file)
try {
const img = await loadImage(objectUrl)
const scale = Math.min(1, max / Math.max(img.width, img.height))
const width = Math.max(1, Math.round(img.width * scale))
const height = Math.max(1, Math.round(img.height * scale))
const canvas = document.createElement('canvas')
canvas.width = width
canvas.height = height
const ctx = canvas.getContext('2d')
if (!ctx) {
throw new Error('could not create canvas context')View on GitHub (pinned to c896c09c42)
Solutions
- Use a smaller reference image (downscale or compress it) and retry.
- Pick an image under the size cap reported by the generator.
When it happens
Trigger: Thrown at apps/desktop/src/app/pet-generate/lib/read-reference-image.ts:22 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14).
Data as JSON: /api/errors/ff4b30c261769a59.
Report an issue: GitHub.