{"record":{"id":"f06364e5c23b8439","repo":"linshenkx/prompt-optimizer","slug":"image-understanding-service-is-not-available-for-m","errorCode":null,"errorMessage":"Image understanding service is not available for multimodal evaluation.","messagePattern":"Image understanding service is not available for multimodal evaluation\\.","errorType":"exception","errorClass":"EvaluationExecutionError","httpStatus":null,"severity":"critical","filePath":"packages/core/src/services/evaluation/service.ts","lineNumber":705,"sourceCode":"\n    if (request.type === 'result') {\n      return this.hasSnapshotOutputMedia(request.snapshot);\n    }\n\n    if (request.type === 'compare') {\n      return request.snapshots.some((snapshot) => this.hasSnapshotOutputMedia(snapshot));\n    }\n\n    return false;\n  }\n\n  private async executeMultimodalEvaluation(\n    request: Extract<EvaluationRequest, { type: 'result' | 'compare' }>,\n    messages: Message[],\n    modelConfig: TextModelConfig\n  ): Promise<string> {\n    if (!this.imageUnderstandingService) {\n      throw new EvaluationExecutionError(\n        'Image understanding service is not available for multimodal evaluation.'\n      );\n    }\n\n    const { systemPrompt, userPrompt } = this.splitEvaluationMessages(messages);\n    const resolvedMedia = await this.resolveEvaluationMedia(request);\n    const manifest = this.buildImageEvidenceManifest(resolvedMedia);\n\n    const result = await this.imageUnderstandingService.understand({\n      modelConfig,\n      systemPrompt,\n      userPrompt: `${userPrompt}\\n\\n${manifest}`.trim(),\n      images: resolvedMedia.map((item) => ({\n        b64: item.b64,\n        mimeType: item.mimeType,\n      })),\n    });\n","sourceCodeStart":687,"sourceCodeEnd":723,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/core/src/services/evaluation/service.ts#L687-L723","documentation":"EvaluationExecutionError thrown by executeMultimodalEvaluation when shouldUseMultimodalEvaluation(request) is true (image-mode result/compare) but no imageUnderstandingService was provided to EvaluationService. Multimodal evaluation requires that dependency to send images to a vision-capable model; without it the request cannot run.","triggerScenarios":"Constructing EvaluationService without imageUnderstandingService, then calling evaluate/evaluateStream with an image text-2-image request that passes validateRequest and reaches executeMultimodalEvaluation (invoked from evaluateStream's content path).","commonSituations":"DI wiring incomplete in tests or a trimmed-down deployment; new image evaluation feature enabled by mode config while the service composition was never updated; optional dependency omitted because text evaluations worked fine.","solutions":["Provide an imageUnderstandingService instance when constructing EvaluationService","If you don't need image evaluation, change mode.functionMode/subMode so multimodal path isn't selected","Add a startup assertion that imageUnderstandingService is present whenever image modes are configurable"],"exampleFix":"// before\nconst svc = new EvaluationService({ modelManager, templateManager, llmService });\n\n// after\nconst svc = new EvaluationService({\n  modelManager, templateManager, llmService,\n  imageUnderstandingService: new ImageUnderstandingService(...),\n});","handlingStrategy":"validation","validationCode":"if (isImageMode(req.mode) && !imageUnderstandingService) {\n  throw new Error('Image evaluation requires imageUnderstandingService to be wired');\n}","typeGuard":"const canDoMultimodal = (svc: EvaluationService) => Boolean((svc as any).imageUnderstandingService);","tryCatchPattern":"try { await svc.evaluateStream(req, cb); } catch (e) { if (e instanceof EvaluationExecutionError && /Image understanding service/.test(e.message)) disableImageModes(); else throw e; }","preventionTips":["Assert required optional dependencies at DI composition time","Add a startup capability check when image modes are enabled"],"tags":["evaluation","multimodal","dependency-injection","configuration"],"backgroundTag":"missing-service-dependency","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}