Yeachan-Heo/oh-my-codex · error · Error
sanitizeTeamName: empty after sanitization
Error message
sanitizeTeamName: empty after sanitization
What it means
sanitizeTeamName normalizes a team name (lowercase, separators collapsed, trimmed to 30 chars) before it is embedded in tmux session/pane identifiers. If the input consists only of characters that are all stripped during sanitization (e.g. punctuation/whitespace), the result is the empty string, which cannot be used as a tmux name, so the function throws.
Source
Thrown at src/team/tmux-session.ts:2315
workerCli,
command: platformSpec.command,
args: platformSpec.args,
env: scrubTeamWorkerHudOwnershipEnv(workerEnv),
};
}
// Sanitize team name: lowercase, alphanumeric + hyphens, max 30 chars
export function sanitizeTeamName(name: string): string {
const lowered = name.toLowerCase();
const replaced = lowered
.replace(/[^a-z0-9]+/g, '-')
.replace(/-+/g, '-')
.replace(/^-/, '')
.replace(/-$/, '');
const truncated = replaced.slice(0, 30).replace(/-$/, '');
if (truncated.trim() === '') {
throw new Error('sanitizeTeamName: empty after sanitization');
}
return truncated;
}
/**
* Detect whether the process is running inside a WSL2 environment.
* WSL2 always sets WSL_DISTRO_NAME; WSL_INTEROP is also present.
* Fallback: check /proc/version for the Microsoft kernel string.
*/
export function isWsl2(): boolean {
if (process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP) {
return true;
}
try {
const version = readFileSync('/proc/version', 'utf-8');
return /microsoft/i.test(version);
} catch {
return false;View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Use a team name containing at least one alphanumeric ASCII character, e.g. 'team-1'.
- Pre-validate/sanitize the name yourself before calling the API and fall back to a default like `team` when empty.
- If names come from automation, slugify upstream identifiers and guarantee a non-empty prefix.
Example fix
// before
createTeamSession('!!!', 3);
// after
const name = sanitize('!!!') || 'team';
createTeamSession(name, 3); Defensive patterns
Strategy: validation
Validate before calling
const okTeamName = (n: string) => /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/.test(n) && n.length <= 30 && n.length > 0; if (!okTeamName(teamName)) teamName = 'team';
Type guard
const isSanitizableTeamName = (n: unknown): n is string => typeof n === 'string' && /[a-z0-9]/i.test(n);
Prevention
- Default missing/empty names to a constant like 'team'.
- Slugify external identifiers before passing them as team names.
When it happens
Trigger: Calling createTeamSession (or any API that derives a tmux session name) with a teamName like '!!!', '---', ' ', or non-ASCII characters that are all removed by the sanitizer, so truncated.trim() === ''.
Common situations: Passing user-supplied or CLI-provided team names containing only symbols/emoji, dynamically generated names from branch names or ticket IDs that sanitize to nothing, or passing undefined-ish placeholders like '-'.
Related errors
- invalid auth slot path
- invalid detached leader authority target
- malformed detached leader authority
- Team mode requires running inside tmux current leader pane
- startup_worker_pane_pid_unavailable:${paneId}
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/bc6e6879953dc97e.
Report an issue: GitHub.