iOfficeAI/AionUi · error
Image file not found. Searched paths: ${possiblePaths.map((p
Error message
Image file not found. Searched paths:
${possiblePaths.map((p) => `- ${p}`).join('\n')}\n\nPlease ensure the image file exists and has a valid image extension (.jpg, .png, .gif, .webp, etc.) What it means
Thrown by processImageUri in imageGenCore.ts when the image URI passed to the message cannot be resolved to an existing file on disk. The function tries the raw URI and the URI resolved against the workspace directory, and when neither exists (and the underlying error is not a 'not a supported image type' error), it throws with the list of searched paths and the original error attached as cause.
Source
Thrown at packages/desktop/src/common/chat/imageGenCore.ts:189
const base64Data = await fileToBase64(fullPath);
const mimeType = getImageMimeType(fullPath);
return {
type: 'image_url',
image_url: { url: `data:${mimeType};base64,${base64Data}`, detail: 'auto' },
};
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
if (
errorMessage.includes('Path traversal blocked') ||
errorMessage.includes('Image file not found') ||
errorMessage.includes('not a supported image type')
) {
throw error;
}
const possiblePaths = [imageUri, path.resolve(workspaceDir, imageUri)].filter((p, i, arr) => arr.indexOf(p) === i);
throw new Error(
`Image file not found. Searched paths:\n${possiblePaths.map((p) => `- ${p}`).join('\n')}\n\nPlease ensure the image file exists and has a valid image extension (.jpg, .png, .gif, .webp, etc.)`,
{ cause: error }
);
}
}
// ===== Core Execution =====
export interface ImageGenParams {
prompt: string;
image_uris?: string[] | string;
}
export interface ImageGenResult {
success: boolean;
text: string;
imagePath?: string;
relativeImagePath?: string;View on GitHub (pinned to 711aa0550e)
Solutions
- Verify the file exists at one of the searched paths printed in the error message
- If using a relative path, make sure it is relative to workspaceDir or pass an absolute path
- Check the filename spelling, extension (.jpg/.png/.gif/.webp), and that it was not deleted or moved
- If the path contains encoded characters, decode it (decodeURIComponent) before passing it in
- Re-attach or regenerate the image so a fresh, existing path is used
Example fix
// before
await processImageUri('img-out/pic1.png', workspaceDir);
// after
import path from 'node:path';
const abs = path.resolve(workspaceDir, 'img-out', 'pic1.png');
if (!fs.existsSync(abs)) throw new Error(`missing image: ${abs}`);
await processImageUri(abs, workspaceDir); Defensive patterns
Strategy: validation
Validate before calling
import fs from 'node:fs';
import path from 'node:path';
const findImage = (uri: string, workspaceDir: string): string | null => {
const candidates = [uri, path.resolve(workspaceDir, uri)];
return candidates.find((p) => fs.existsSync(p) && fs.statSync(p).isFile()) ?? null;
};
const resolved = findImage(imageUri, workspaceDir);
if (!resolved) {
// show picker / regenerate instead of calling processImageUri
}
await processImageUri(resolved!, workspaceDir); Type guard
const isExistingImagePath = (p: string): boolean => /\.(jpe?g|png|gif|webp)$/i.test(p) && fs.existsSync(p);
Try / catch
try {
await processImageUri(uri, workspaceDir);
} catch (err) {
if (err instanceof Error && err.message.startsWith('Image file not found')) {
// prompt user to re-attach the image; cause has the original fs error
logger.warn('image missing', err.cause);
} else throw err;
} Prevention
- Store and pass absolute paths for chat attachments
- Validate existence + extension before adding an image to a message
- Re-verify paths after app restart since temp dirs get cleaned
- Decode URI components before resolving file paths
When it happens
Trigger: Calling an image-generation/send-message API with an imageUri that is a relative filename not present in the working directory, a stale absolute path from a previous session, a file that was deleted or moved, or a path with a typo or missing image extension. Only fired when fs access fails and the error message does not include ENOENT-alternatives like 'not a supported image type'.
Common situations: Restarting the app after temp image files were cleaned up; referencing generated images by relative path while the process cwd differs from the workspace dir; user deleting attachments from disk while the chat still references them; URI encoding issues (%20 spaces) making the resolved path not match the real file.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
AI-assisted analysis of iOfficeAI/AionUi@711aa0550e (2026-08-28).
Data as JSON: /api/errors/b2f4e902c134991f.
Report an issue: GitHub.