ruvnet/ruflo · error · Error
Invalid priority: ${priority}
Error message
Invalid priority: ${priority} What it means
WorkerQueue.submitTask accepts options.priority only from the closed set ['critical', 'high', 'normal', 'low'] (default 'normal'). Any other string — 'medium', 'URGENT', 'highest' — fails the includes() check and throws with the offending value in the message. The validation happens on every submit, after the workerType check.
Source
Thrown at v3/@claude-flow/cli/src/services/worker-queue.ts:329
priority?: WorkerPriority;
maxRetries?: number;
timeoutMs?: number;
}
): Promise<string> {
// Initialize if needed
if (!this.initialized) {
await this.initialize();
}
// Validate worker type
if (!workerType || typeof workerType !== 'string') {
throw new Error('Invalid worker type');
}
// Validate priority
const priority = options?.priority || 'normal';
if (!['critical', 'high', 'normal', 'low'].includes(priority)) {
throw new Error(`Invalid priority: ${priority}`);
}
const taskId = `task-${Date.now()}-${randomUUID().slice(0, 8)}`;
const task: QueueTask = {
id: taskId,
workerType,
priority,
payload: {
...payload,
timeoutMs: options?.timeoutMs || this.config.defaultTimeoutMs,
},
status: 'pending',
createdAt: new Date(),
retryCount: 0,
maxRetries: options?.maxRetries ?? this.config.maxRetries,
};
View on GitHub (pinned to fa13ee4ad6)
Solutions
- Use one of: 'critical', 'high', 'normal', 'low' (lowercase, exact match) or omit priority to get 'normal'
- If mapping from another scale, translate before submitting (e.g. 1->'low', 2->'normal', 3->'high', 4->'critical')
- Whitelist external priority strings against the four allowed values and reject/fallback before calling submitTask
- The error message includes the bad value — use it to spot casing or whitespace issues like ' high'
Example fix
// before
await queue.submitTask('audit', payload, { priority: 'urgent' }); // throws: Invalid priority: urgent
// after
const PRIORITY = ['critical', 'high', 'normal', 'low'] as const;
const raw = String(userInput.priority ?? 'normal').toLowerCase() as (typeof PRIORITY)[number];
const priority = PRIORITY.includes(raw) ? raw : 'normal';
await queue.submitTask('audit', payload, { priority }); Defensive patterns
Strategy: type-guard
Validate before calling
const priority = options?.priority ?? 'normal'; // rely on the default rather than passing 'medium'-style values from other vocabularies
Type guard
const WORKER_PRIORITIES = ['critical', 'high', 'normal', 'low'] as const;
export type WorkerPriority = (typeof WORKER_PRIORITIES)[number];
function isWorkerPriority(value: unknown): value is WorkerPriority {
return typeof value === 'string' && (WORKER_PRIORITIES as readonly string[]).includes(value);
} Prevention
- Type the priority option as the literal union so the compiler rejects 'medium'/'urgent' at build time
- Normalize external priority input (lowercase + whitelist) before submitting tasks
- Remember omitting priority is valid and defaults to 'normal'
When it happens
Trigger: Calling submitTask(type, payload, { priority: 'medium' }); priorities sourced from user input or another library whose scale differs (e.g. 1-5 numbers coerced oddly, or 'urgent'/'highest' vocabulary); case mismatches like 'High'.
Common situations: Porting code from a system with different priority vocabularies; passing priorities read from a config file or message queue header without whitelisting; typos and casing differences ('Critical' vs 'critical').
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Invalid worker type
- Invalid completion type
- mode must be legacy, observe, or enforce
- Unknown worker type: ${type}
- Worker types must be a non-empty array
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/321d8f90546f78a5.
Report an issue: GitHub.