linshenkx/prompt-optimizer · critical · EvaluationExecutionError
Image storage service is required to resolve evaluation imag
Error message
Image storage service is required to resolve evaluation image asset "${assetId}". What it means
EvaluationExecutionError thrown by resolveEvaluationMediaItem when an evidence item has an assetId but EvaluationService was constructed without an imageStorageService. Resolving stored assets requires that service; without it the asset reference cannot be dereferenced, so multimodal execution aborts.
Source
Thrown at packages/core/src/services/evaluation/service.ts:857
const label = mediaItem.label?.trim() || 'image';
const inlineB64 = mediaItem.b64?.trim() || '';
const assetId = mediaItem.assetId?.trim() || '';
if (inlineB64) {
return {
b64: inlineB64,
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 {View on GitHub (pinned to 3e677b1d9f)
Solutions
- Provide an imageStorageService when constructing EvaluationService whenever assets may be referenced by id
- Alternatively, embed images inline as b64 evidence so no storage service is needed
- Add a startup/diagnostic check: if any configured mode is image-based, require imageStorageService
Example fix
// before
const svc = new EvaluationService({ modelManager, templateManager, llmService, imageUnderstandingService });
// after
const svc = new EvaluationService({
modelManager, templateManager, llmService, imageUnderstandingService,
imageStorageService,
}); Defensive patterns
Strategy: validation
Validate before calling
const usesAssets = evidence.some(e => Boolean(e.assetId) && !e.b64);
if (usesAssets && !imageStorageService) throw new Error('assetId evidence requires imageStorageService'); Type guard
const serviceSupportsAssets = (svc: EvaluationService) => Boolean((svc as any).imageStorageService);
Try / catch
try { await svc.evaluate(req); } catch (e) { if (e instanceof EvaluationExecutionError && /Image storage service/.test(e.message)) { inlineB64EvidenceAndRetry(); } else throw e; } Prevention
- Wire imageStorageService whenever image modes are configurable
- Prefer inline b64 in tests that skip storage
- Assert constructor dependencies in DI tests
When it happens
Trigger: Evidence items reference stored images by assetId while EvaluationService lacks imageStorageService in its constructor options — common in unit tests or minimal DI setups — and an image-mode evaluation runs.
Common situations: DI composition updated for text-only usage and image storage omitted; test harness constructing the service with mocks but no image store; refactor dropped an optional constructor parameter; deployment profile that disabled image persistence.
Related errors
- Image understanding service is not available for multimodal
- Image result evaluation requires at least one output image e
- Image compare evaluation requires at least two snapshots wit
- Image compare evaluation requires every compared snapshot to
- No valid image evidence could be resolved for evaluation.
AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27).
Data as JSON: /api/errors/462860c44f6a2355.
Report an issue: GitHub.