{"record":{"id":"2eca7e37b6ad4314","repo":"linshenkx/prompt-optimizer","slug":"label-output-must-not-be-empty","errorCode":null,"errorMessage":"${label} output must not be empty.","messagePattern":"(.+?) output must not be empty\\.","errorType":"validation","errorClass":"EvaluationValidationError","httpStatus":null,"severity":"error","filePath":"packages/core/src/services/evaluation/service.ts","lineNumber":1733,"sourceCode":"    }\n    this.validateContentBlock(testCase.input, `${label} input`);\n  }\n\n  private validateSnapshot(snapshot: EvaluationSnapshot | undefined, label: string): void {\n    if (!snapshot?.id?.trim()) {\n      throw new EvaluationValidationError(`${label} id must not be empty.`);\n    }\n    if (!snapshot?.label?.trim()) {\n      throw new EvaluationValidationError(`${label} label must not be empty.`);\n    }\n    if (!snapshot?.testCaseId?.trim()) {\n      throw new EvaluationValidationError(`${label} testCaseId must not be empty.`);\n    }\n    if (!snapshot?.promptText?.trim()) {\n      throw new EvaluationValidationError(`${label} promptText must not be empty.`);\n    }\n    if (!snapshot?.output?.trim()) {\n      throw new EvaluationValidationError(`${label} output must not be empty.`);\n    }\n    if (!snapshot?.promptRef?.kind) {\n      throw new EvaluationValidationError(`${label} promptRef.kind must not be empty.`);\n    }\n    if (snapshot.executionInput) {\n      this.validateContentBlock(snapshot.executionInput, `${label} executionInput`);\n    }\n    if (snapshot.outputBlock) {\n      this.validateContentBlock(snapshot.outputBlock, `${label} outputBlock`);\n    }\n  }\n\n  private normalizeContentBlock(block?: EvaluationContentBlock): NormalizedContentBlock | undefined {\n    const label = block?.label?.trim() || '';\n    const content = block?.content?.trim() || '';\n    if (!label || (!content && !this.hasBlockMedia(block))) {\n      return undefined;\n    }","sourceCodeStart":1715,"sourceCodeEnd":1751,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/core/src/services/evaluation/service.ts#L1715-L1751","documentation":"EvaluationValidationError thrown when snapshot.output is missing or blank. The output is the model response being scored, so an evaluation without output is meaningless and is rejected up front. This mirrors the other required snapshot fields (id, label, testCaseId, promptText).","triggerScenarios":"Submitting a snapshot whose output field is undefined, null, empty, or whitespace — e.g. the model call failed or returned empty content and the caller proceeded to evaluate anyway.","commonSituations":"Evaluating failed/aborted LLM calls without checking the response body first; streaming pipelines that persist snapshots before the full output arrives; accidentally mapping response.text to the wrong key.","solutions":["Skip or queue snapshots whose upstream model call produced empty output","Populate snapshot.output with the model's final text before calling the evaluation API","Add an assertion after the model call: if (!output.trim()) skip/flag the case"],"exampleFix":"// before\nsnaps.push({ ...base, output: res.output ?? '' });\n\n// after\nif (res.output?.trim()) snaps.push({ ...base, output: res.output });\nelse skipped.push(base.testCaseId);","handlingStrategy":"validation","validationCode":"if (!modelOutput?.trim()) { skipped.push(testCaseId); continue; } // never evaluate empty outputs","typeGuard":"const hasOutput = (s: unknown): s is { output: string } => typeof (s as any)?.output === 'string' && (s as any).output.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Check model responses for empty content before persisting snapshots","Treat empty outputs as skipped cases, not evaluation inputs"],"tags":["validation","evaluation","model-output"],"backgroundTag":"required-field-validation-failed","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}