eyaltoledano/claude-task-master · error
Parameter validation failed: ${errors.join('; ')}
Error message
Parameter validation failed: ${errors.join('; ')} What it means
PromptManager.validateParameters throws this when a prompt template's declared parameters are missing, malformed, or fail type validation. It aggregates all individual parameter problems (missing parameter, unknown type, failed type check) into a single semicolon-joined message so the caller can fix everything at once. It surfaces at loadPrompt time, meaning the prompt cannot be used until its schema matches its parameters.
Source
Thrown at scripts/modules/prompt-manager.js:221
}
// Range validation for numbers
if (typeof value === 'number') {
if (paramConfig.minimum !== undefined && value < paramConfig.minimum) {
errors.push(
`Parameter '${paramName}' must be >= ${paramConfig.minimum}`
);
}
if (paramConfig.maximum !== undefined && value > paramConfig.maximum) {
errors.push(
`Parameter '${paramName}' must be <= ${paramConfig.maximum}`
);
}
}
}
if (errors.length > 0) {
throw new Error(`Parameter validation failed: ${errors.join('; ')}`);
}
}
/**
* Validate parameter type
* @private
*/
validateParameterType(value, expectedType) {
switch (expectedType) {
case 'string':
return typeof value === 'string';
case 'number':
return typeof value === 'number';
case 'boolean':
return typeof value === 'boolean';
case 'array':
return Array.isArray(value);
case 'object':View on GitHub (pinned to c0c98d367c)
Solutions
- Read the semicolon-joined list in the message; each entry names the failing parameter and reason.
- Fix the parameter definitions (name, type, required flag) in the prompt config to match the expected schema.
- Correct default values so they conform to the declared type.
- Re-run loadPrompt to confirm all parameters validate.
Example fix
// before
{ "name": "model", "type": "stringe", "required": true }
// after
{ "name": "model", "type": "string", "required": true } Defensive patterns
Strategy: validation
Validate before calling
function validatePromptParams(prompt) {
const validTypes = ['string','number','boolean','object','array'];
const errors = [];
for (const p of prompt.parameters || []) {
if (!p.name) errors.push(`${prompt.id}: parameter missing name`);
if (!validTypes.includes(p.type)) errors.push(`${prompt.id}: ${p.name} invalid type ${p.type}`);
if (p.required === false && p.default === undefined) errors.push(`${prompt.id}: ${p.name} optional but no default`);
}
if (errors.length) throw new Error(errors.join('; '));
} Type guard
function hasValidParams(p) {
return Array.isArray(p?.parameters) &&
p.parameters.every(x => typeof x?.name === 'string' && typeof x?.type === 'string');
} Try / catch
try {
const prompt = await manager.loadPrompt(id, params);
} catch (err) {
if (err.message.startsWith('Parameter validation failed')) {
// inspect err.message after the prefix for per-parameter issues
console.error('Fix prompt parameters:', err.message);
} else throw err;
} Prevention
- Keep prompt parameter definitions in reviewed config files, not hand-edited ad hoc
- Validate prompt configs in CI before deployment
- Use consistent type names across all prompts
- Pair every required flag with either required=true or a default
When it happens
Trigger: Calling loadPrompt for a prompt whose parameter defaults or required flags are inconsistent, a parameter has an unsupported type string, or a default value does not match the declared type.
Common situations: Hand-edited prompt JSON/config files, adding a new parameter without updating defaults, typos in parameter type names, or upgrading prompts from an older format.
Related errors
- MISSING_CONFIGURATION
- INVALID_INPUT
- Unknown provider '${providerName}' for API key resolution.
- Prompt template '${promptId}' not found
- Schema validation failed: ${errors}
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/6a8abca3f884aabc.
Report an issue: GitHub.