linshenkx/prompt-optimizer · error · EvaluationValidationError
Iteration requirement must not be empty.
Error message
Iteration requirement must not be empty.
What it means
Thrown for type:'prompt-iterate' when request.iterateRequirement is missing or whitespace-only. The iteration requirement tells the LLM how to improve the prompt; without it there is nothing to iterate toward. Raised as an EvaluationValidationError in validateRequest.
Source
Thrown at packages/core/src/services/evaluation/service.ts:544
throw new EvaluationValidationError(
'Image compare evaluation requires every compared snapshot to include output image evidence.'
);
}
}
break;
case 'prompt-only':
if (!request.target?.workspacePrompt?.trim()) {
throw new EvaluationValidationError('Workspace prompt must not be empty.');
}
break;
case 'prompt-iterate':
if (!request.target?.workspacePrompt?.trim()) {
throw new EvaluationValidationError('Workspace prompt must not be empty.');
}
if (!request.iterateRequirement?.trim()) {
throw new EvaluationValidationError('Iteration requirement must not be empty.');
}
break;
default:
throw new EvaluationValidationError(`Unknown evaluation type: ${(request as any).type}`);
}
}
/**
* 验证评估模型
*/
private async validateModel(modelKey: string): Promise<TextModelConfig> {
const model = await this.modelManager.getModel(modelKey);
if (!model) {
throw new EvaluationModelError(modelKey);
}
return model;
}View on GitHub (pinned to 3e677b1d9f)
Solutions
- Collect and pass a non-empty iterateRequirement describing the desired change
- Disable the iterate action until a requirement is entered
- Default the requirement to a generic instruction if your product intends one (e.g. 'improve clarity')
Example fix
// before
await svc.evaluate({ type: 'prompt-iterate', target, iterateRequirement: '' });
// after
await svc.evaluate({ type: 'prompt-iterate', target, iterateRequirement: 'Make it more concise.' }); Defensive patterns
Strategy: validation
Validate before calling
if (!req.iterateRequirement?.trim()) throw new Error('Describe what to change before iterating');
await svc.evaluate(req); Type guard
const hasRequirement = (r: PromptIterateRequest) => Boolean(r.iterateRequirement?.trim());
Prevention
- Require the requirement input in the form
- Offer sensible default requirements
When it happens
Trigger: evaluate({type:'prompt-iterate', ...}) with iterateRequirement omitted, empty, or only whitespace.
Common situations: User clicks 'iterate' without describing what to change; requirement field not wired into the request payload; requirement cleared by a form reset but submit still fired.
Related errors
- ${label} promptText must not be empty.
- Result evaluation snapshot testCaseId must match testCase.id
- Image result evaluation requires at least one output image e
- Compare evaluation requires at least one test case.
- Compare evaluation requires at least two snapshots.
AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27).
Data as JSON: /api/errors/dfe9d981e2cb1da0.
Report an issue: GitHub.