{"record":{"id":"90b40ef8cbb280ec","repo":"linshenkx/prompt-optimizer","slug":"label-label-must-not-be-empty","errorCode":null,"errorMessage":"${label} label must not be empty.","messagePattern":"(.+?) label must not be empty\\.","errorType":"validation","errorClass":"EvaluationValidationError","httpStatus":null,"severity":"error","filePath":"packages/core/src/services/evaluation/service.ts","lineNumber":1700,"sourceCode":"      }\n\n      if (assetId && b64) {\n        throw new EvaluationValidationError(\n          `${label} #${index + 1} must not provide both assetId and b64.`\n        );\n      }\n    });\n  }\n\n  private validateContentBlock(\n    block: EvaluationContentBlock | undefined,\n    label: string\n  ): void {\n    if (!block) {\n      throw new EvaluationValidationError(`${label} must not be empty.`);\n    }\n    if (!block.label?.trim()) {\n      throw new EvaluationValidationError(`${label} label must not be empty.`);\n    }\n    const hasContent = !!block.content?.trim();\n    const hasMedia = this.hasBlockMedia(block);\n    if (!hasContent && !hasMedia) {\n      throw new EvaluationValidationError(`${label} content must not be empty.`);\n    }\n    if (block.media) {\n      this.validateMediaItems(block.media, `${label} media`);\n    }\n  }\n\n  private validateTestCase(testCase: EvaluationTestCase | undefined, label: string): void {\n    if (!testCase?.id?.trim()) {\n      throw new EvaluationValidationError(`${label} id must not be empty.`);\n    }\n    this.validateContentBlock(testCase.input, `${label} input`);\n  }\n","sourceCodeStart":1682,"sourceCodeEnd":1718,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/core/src/services/evaluation/service.ts#L1682-L1718","documentation":"Every content block (e.g. a test case input) must itself carry a non-empty label so runs and results can be identified. validateContentBlock throws when the block exists but block.label is missing or whitespace-only.","triggerScenarios":"A content block like { content: 'hello' } with no label, or label: '   '. The label placeholder in the message identifies which block (e.g. 'Test case #1 input').","commonSituations":"Copy-pasted payloads with label stripped; programmatic test-case generation that only sets content; localization/import tooling leaving labels blank.","solutions":["Add a descriptive non-empty label to the content block named in the message","Use the error's block label to locate the exact failing block in your payload","Add a client-side lint over evaluation payloads before submission"],"exampleFix":"// before\ninput: { content: 'Translate this' }\n\n// after\ninput: { label: 'translation prompt', content: 'Translate this' }","handlingStrategy":"validation","validationCode":"function assertBlockLabels(blocks: { label?: string }[]): void {\n  blocks.forEach((b, i) => {\n    if (!b?.label?.trim()) throw new Error(`block[${i}] missing label`);\n  });\n}","typeGuard":"const hasBlockLabel = (b: { label?: string } | undefined): boolean => !!b?.label?.trim();","tryCatchPattern":"try {\n  await evaluationService.create(request);\n} catch (err) {\n  if (err instanceof EvaluationValidationError && /label must not be empty/.test(err.message)) {\n    promptUserForLabel(err.message);\n  } else throw err;\n}","preventionTips":["Require labels in UI forms","Auto-fill labels (e.g. from content preview) when generating payloads","Trim and assert non-empty before submit"],"tags":["evaluation","validation","label","content-block"],"backgroundTag":"schema-validation-failed","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}