{"record":{"id":"176072b4cb3b473a","repo":"linshenkx/prompt-optimizer","slug":"formatexecutionerrormessage-error","errorCode":null,"errorMessage":"formatExecutionErrorMessage(error)","messagePattern":"formatExecutionErrorMessage\\(error\\)","errorType":"exception","errorClass":"EvaluationExecutionError","httpStatus":null,"severity":"error","filePath":"packages/core/src/services/evaluation/service.ts","lineNumber":2202,"sourceCode":"      const synthesisResult = await this.llmService.sendMessage(\n        synthesisMessages,\n        request.evaluationModelKey\n      );\n      const duration = Date.now() - startTime;\n      const responseMetadata = this.buildResponseMetadata(\n        request,\n        {\n          model: request.evaluationModelKey,\n          timestamp: Date.now(),\n          duration,\n          compareJudgements: judgeResults,\n        },\n        normalizedCompare\n      );\n\n      return this.parseEvaluationResult(synthesisResult, request.type, responseMetadata);\n    } catch (error) {\n      throw new EvaluationExecutionError(\n        this.formatExecutionErrorMessage(error),\n        error instanceof Error ? error : undefined\n      );\n    }\n  }\n\n  private async evaluateStructuredCompareStream(\n    request: Extract<EvaluationRequest, { type: 'compare' }>,\n    normalizedCompare: NormalizedCompareContext,\n    callbacks: EvaluationStreamHandlers\n  ): Promise<void> {\n    const startTime = Date.now();\n    const language = await this.resolveComparePromptLanguage();\n    const subject = this.resolveComparePromptSubjectConfig(request.mode, language);\n\n    try {\n      const judgeResults = await this.executeStructuredCompareJudgePlan(\n        request,","sourceCodeStart":2184,"sourceCodeEnd":2220,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/core/src/services/evaluation/service.ts#L2184-L2220","documentation":"EvaluationExecutionError wrapping any underlying failure thrown while invoking the judge/synthesis model during an evaluation run. The original error message is formatted via formatExecutionErrorMessage and the original Error is preserved as the cause. It signals an infrastructure/transport/model failure rather than bad input data.","triggerScenarios":"Any exception from the model call or comparison step inside the evaluation execution path: network timeout, provider 4xx/5xx, rate limiting, invalid API key, or malformed request to the model provider.","commonSituations":"Expired or wrong LLM API key; provider rate limits during batch evaluations; proxy/firewall blocking the model endpoint; oversized promptText exceeding the provider's context limit mid-run.","solutions":["Inspect the wrapped message and the original cause (error.cause) to identify the real failure","Fix provider credentials/rate limits/network issues accordingly","Retry transient failures with exponential backoff; cap promptText length before evaluating"],"exampleFix":"// before\nconst result = await svc.runEvaluation(req);\n\n// after\ntry {\n  const result = await svc.runEvaluation(req);\n} catch (e) {\n  if (e instanceof EvaluationExecutionError) {\n    logger.error('eval failed', { cause: e.cause?.message });\n    await backoff.retry(() => svc.runEvaluation(req));\n  } else throw e;\n}","handlingStrategy":"retry","validationCode":"await provider.models.list(); // cheap pre-flight to verify credentials/connectivity before a long eval run","typeGuard":null,"tryCatchPattern":"try {\n  const result = await svc.runEvaluation(req);\n} catch (e) {\n  if (e instanceof EvaluationExecutionError) {\n    const cause = (e.cause as Error)?.message ?? e.message;\n    if (isTransient(cause)) return await retry(() => svc.runEvaluation(req), { retries: 3, backoff: 'exponential' });\n    throw e;\n  }\n  throw e;\n}","preventionTips":["Verify API keys and provider connectivity before batch runs","Set sane timeouts and cap prompt sizes","Use exponential-backoff retry for rate-limit/network causes"],"tags":["evaluation","model-provider","network","retry"],"backgroundTag":"llm-api-request-failed","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}