linshenkx/prompt-optimizer · error · EvaluationValidationError
${label} label must not be empty.
Error message
${label} label must not be empty. What it means
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.
Source
Thrown at packages/core/src/services/evaluation/service.ts:1700
}
if (assetId && b64) {
throw new EvaluationValidationError(
`${label} #${index + 1} must not provide both assetId and b64.`
);
}
});
}
private validateContentBlock(
block: EvaluationContentBlock | undefined,
label: string
): void {
if (!block) {
throw new EvaluationValidationError(`${label} must not be empty.`);
}
if (!block.label?.trim()) {
throw new EvaluationValidationError(`${label} label must not be empty.`);
}
const hasContent = !!block.content?.trim();
const hasMedia = this.hasBlockMedia(block);
if (!hasContent && !hasMedia) {
throw new EvaluationValidationError(`${label} content must not be empty.`);
}
if (block.media) {
this.validateMediaItems(block.media, `${label} media`);
}
}
private validateTestCase(testCase: EvaluationTestCase | undefined, label: string): void {
if (!testCase?.id?.trim()) {
throw new EvaluationValidationError(`${label} id must not be empty.`);
}
this.validateContentBlock(testCase.input, `${label} input`);
}
View on GitHub (pinned to 3e677b1d9f)
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
Example fix
// before
input: { content: 'Translate this' }
// after
input: { label: 'translation prompt', content: 'Translate this' } Defensive patterns
Strategy: validation
Validate before calling
function assertBlockLabels(blocks: { label?: string }[]): void {
blocks.forEach((b, i) => {
if (!b?.label?.trim()) throw new Error(`block[${i}] missing label`);
});
} Type guard
const hasBlockLabel = (b: { label?: string } | undefined): boolean => !!b?.label?.trim(); Try / catch
try {
await evaluationService.create(request);
} catch (err) {
if (err instanceof EvaluationValidationError && /label must not be empty/.test(err.message)) {
promptUserForLabel(err.message);
} else throw err;
} Prevention
- Require labels in UI forms
- Auto-fill labels (e.g. from content preview) when generating payloads
- Trim and assert non-empty before submit
When it happens
Trigger: 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').
Common situations: Copy-pasted payloads with label stripped; programmatic test-case generation that only sets content; localization/import tooling leaving labels blank.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- ${label} #${index + 1} label must not be empty.
- ${label} must not be empty.
- ${label} content must not be empty.
- Result evaluation snapshot testCaseId must match testCase.id
- Image result evaluation requires at least one output image e
AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27).
Data as JSON: /api/errors/90b40ef8cbb280ec.
Report an issue: GitHub.