linshenkx/prompt-optimizer · error · EvaluationExecutionError
Failed to resolve evaluation image asset "${assetId}".
Error message
Failed to resolve evaluation image asset "${assetId}". What it means
Thrown by EvaluationService.resolveEvaluationMediaItem when an evaluation media item references an image asset by assetId, but the image storage service returns nothing (or empty data) for that id. It means the asset lookup succeeded at the plumbing level but the stored payload is missing or blank, so the evaluation cannot proceed with that media item.
Source
Thrown at packages/core/src/services/evaluation/service.ts:864
mimeType: mediaItem.mimeType?.trim() || 'image/png',
};
}
if (!assetId) {
throw new EvaluationExecutionError(
`Evaluation image evidence "${label}" is missing both assetId and b64 data.`
);
}
if (!this.imageStorageService) {
throw new EvaluationExecutionError(
`Image storage service is required to resolve evaluation image asset "${assetId}".`
);
}
const storedImage = await this.imageStorageService.getImage(assetId);
if (!storedImage?.data?.trim()) {
throw new EvaluationExecutionError(
`Failed to resolve evaluation image asset "${assetId}".`
);
}
return {
b64: storedImage.data,
mimeType: mediaItem.mimeType?.trim() || storedImage.metadata?.mimeType || 'image/png',
};
}
private buildEvaluationMediaIdentity(mediaItem: EvaluationMediaItem): string {
const assetId = mediaItem.assetId?.trim() || '';
if (assetId) {
return `asset:${assetId}`;
}
return `inline:${mediaItem.mimeType?.trim() || 'image/png'}:${mediaItem.b64?.trim() || ''}`;
}View on GitHub (pinned to 3e677b1d9f)
Solutions
- Verify the asset still exists: call imageStorageService.getImage(assetId) (or the equivalent upload/list API) before running the evaluation and confirm data is non-empty
- Re-upload the image and update the media item with the fresh assetId
- If storage is ephemeral, switch to embedding the image via b64 in the media item instead of assetId
- Check storage configuration/retention so uploaded assets persist for the duration of the evaluation run
Example fix
// before
const mediaItem = { label: 'screenshot', assetId: staleAssetId };
// after
const stored = await imageStorageService.getImage(staleAssetId);
if (!stored?.data?.trim()) {
const { id } = await imageStorageService.uploadImage(pngBytes);
mediaItem.assetId = id; // fresh assetId
} Defensive patterns
Strategy: validation
Validate before calling
import type { ImageStorageService } from './types';
async function assertAssetsExist(
imageStorageService: ImageStorageService,
assetIds: string[]
): Promise<void> {
for (const id of assetIds) {
const img = await imageStorageService.getImage(id);
if (!img?.data?.trim()) {
throw new Error(`Asset "${id}" missing or empty — re-upload before running the evaluation.`);
}
}
} Type guard
null
Try / catch
try {
await evaluationService.run(evaluation);
} catch (err) {
if (err instanceof EvaluationExecutionError && /Failed to resolve evaluation image asset/.test(err.message)) {
const assetId = err.message.match(/"([^"]+)"/)?.[1];
await reuploadAndRetry(assetId); // or skip this test case and report
} else throw err;
} Prevention
- Persist uploaded assets in durable storage before referencing their ids in evaluations
- Pre-flight check every assetId with getImage() before launching a run
- Prefer inline b64 for short-lived evaluations to avoid storage lifetime issues
When it happens
Trigger: Calling an evaluation API whose media item sets assetId, where imageStorageService.getImage(assetId) resolves to undefined/null or an object whose data is empty/whitespace. Happens when the asset was deleted, expired from storage, or the id is wrong/stale.
Common situations: Assets stored in volatile/in-memory storage that was cleared between runs; referencing an assetId from a previous session; asset upload failed silently; storage retention policy purged the image; wrong storage backend configured between upload and evaluation.
Related errors
- Image storage service is required to resolve evaluation imag
- Result evaluation snapshot testCaseId must match testCase.id
- Image result evaluation requires at least one output image e
- Compare evaluation requires at least one test case.
- Compare evaluation requires at least two snapshots.
AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27).
Data as JSON: /api/errors/2463ee935b8cf74f.
Report an issue: GitHub.