linshenkx/prompt-optimizer · error · EvaluationExecutionError

Evaluation image evidence "${label}" is missing both assetId

Error message

Evaluation image evidence "${label}" is missing both assetId and b64 data.

What it means

EvaluationExecutionError thrown by resolveEvaluationMediaItem for a single evidence item (identified by label, e.g. snapshot index/name) that has neither an assetId nor inline b64 data. The item cannot be turned into an image for the multimodal model, so execution fails even if other items are valid.

Source

Thrown at packages/core/src/services/evaluation/service.ts:851

    return resolvedMedia;
  }

  private async resolveEvaluationMediaItem(
    mediaItem: EvaluationMediaItem
  ): Promise<{ b64: string; mimeType?: string }> {
    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 {

View on GitHub (pinned to 3e677b1d9f)

Solutions

  1. Populate assetId or b64 on every evidence item you submit
  2. Drop empty placeholder items from the evidence array before evaluation
  3. Normalize your evidence schema to {assetId | b64, mimeType} before calling evaluate

Example fix

// before
const evidence = [{ mimeType: 'image/png' }, validItem];

// after
const evidence = [validItem].filter(e => e.assetId || e.b64);
// or: const evidence = [{ ...placeholder, assetId: uploadedId }, validItem];
Defensive patterns

Strategy: validation

Validate before calling

const valid = evidence.filter(e => Boolean(e.assetId?.trim() || e.b64?.trim()));
if (valid.length !== evidence.length) log.warn('Dropping evidence items without assetId/b64');
await svc.evaluate({ ...req, /* evidence: valid */ });

Type guard

const isUsableEvidence = (e: EvidenceItem): boolean => Boolean(e.assetId?.trim() || e.b64?.trim());

Prevention

When it happens

Trigger: Image-mode evaluation where at least one evidence item in the resolved set has empty/undefined assetId AND empty/undefined inlineB64 — for example an item created as a placeholder with only a mimeType, or a URL-only item.

Common situations: Optional evidence objects created with defaults ({mimeType:'image/png'} with no payload); fields named differently (imageId vs assetId) in caller data; b64 stripped by size-limiting middleware or log-safe serialization.

Related errors


AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27). Data as JSON: /api/errors/be789b7d0543bd2f. Report an issue: GitHub.