Yeachan-Heo/oh-my-codex · error · Error
Invalid worker name: "${name}". Must match /^[a-z0-9][a-z0-9
Error message
Invalid worker name: "${name}". Must match /^[a-z0-9][a-z0-9-]{0,63}$/ (lowercase alphanumeric + hyphens, max 64 chars). What it means
Worker name failed the safety pattern /^[a-z0-9][a-z0-9-]{0,63}$/: lowercase alphanumeric plus hyphens, must start alphanumeric, max 64 chars. Thrown by validateWorkerName via mailboxPath, mailboxLockDir, and enqueueDispatchRequest.
Source
Thrown at src/team/state.ts:500
function isTerminalTaskStatus(status: TeamTaskStatus): boolean {
return isTerminalTeamTaskStatus(status);
}
function canTransitionTaskStatus(from: TeamTaskStatus, to: TeamTaskStatus): boolean {
return canTransitionTeamTaskStatus(from, to);
}
function assertPathWithinDir(filePath: string, rootDir: string): void {
const normalizedRoot = resolve(rootDir);
const normalizedPath = resolve(filePath);
if (normalizedPath !== normalizedRoot && !normalizedPath.startsWith(normalizedRoot + sep)) {
throw new Error('Path traversal detected: path is outside the allowed directory');
}
}
function validateWorkerName(name: string): void {
if (!WORKER_NAME_SAFE_PATTERN.test(name)) {
throw new Error(
`Invalid worker name: "${name}". Must match /^[a-z0-9][a-z0-9-]{0,63}$/ (lowercase alphanumeric + hyphens, max 64 chars).`
);
}
}
function validateTaskId(taskId: string): void {
if (!TASK_ID_SAFE_PATTERN.test(taskId)) {
throw new Error(
`Invalid task ID: "${taskId}". Must be a positive integer (digits only, max 20 digits).`
);
}
}
function defaultLeader(): TeamLeader {
return {
session_id: '',
worker_id: 'leader-fixed',
role: 'coordinator',View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Normalize names: lowercase, replace '_' and spaces with '-', strip other characters, cap length at 64
- Validate names at the boundary (CLI/API input) with the same regex before use
- Regenerate a valid name and retry the operation
Example fix
// before
await enqueueDispatchRequest('Worker_One', ...); // throws
// after
const name = 'Worker_One'.toLowerCase().replace(/_/g, '-'); // 'worker-one'
await enqueueDispatchRequest(name, ...); Defensive patterns
Strategy: type-guard
Validate before calling
const WORKER_NAME = /^[a-z0-9][a-z0-9-]{0,63}$/;
function normalizeWorkerName(raw: string): string {
return raw.toLowerCase().replace(/[^a-z0-9-]+/g, '-').replace(/^-+/, '').slice(0, 64);
} Type guard
function isValidWorkerName(name: string): boolean {
return /^[a-z0-9][a-z0-9-]{0,63}$/.test(name);
} Prevention
- Validate worker names at input boundaries with the same regex
- Generate names programmatically (worker-1, worker-2) instead of from free-form text
When it happens
Trigger: Passing a worker name with uppercase letters, underscores, spaces, slashes, leading hyphen, or longer than 64 characters to mailboxPath, mailboxLockDir, or enqueueDispatchRequest.
Common situations: Auto-generated names from hostnames/usernames with dots or uppercase; hand-typed names with underscores; truncation bugs producing >64 char names.
Related errors
- Invalid task ID: "${taskId}". Must be a positive integer (di
- approved_execution_binding_malformed:${sanitized}
- scale_down_cleanup_debt_invalid_team_state_root:${worker.nam
- scale_down_cleanup_debt_invalid_worktree_metadata:${worker.n
- scale_down_cleanup_debt_invalid_worktree_target:${worker.nam
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/224f8ffe89d11198.
Report an issue: GitHub.