Yeachan-Heo/oh-my-codex · error · Error
`enabled` must be boolean
Error message
`enabled` must be boolean
What it means
The tmux-hook config's top-level `enabled` field is missing or not strictly boolean (true/false). The validator rejects truthy values like 1, "true", or "yes" because only strict booleans are accepted.
Source
Thrown at src/cli/tmux-hook.ts:115
function tmuxHookConfigPath(cwd = process.cwd()): string {
return join(omxDir(cwd), 'tmux-hook.json');
}
function tmuxHookStatePath(cwd = process.cwd()): string {
return join(omxDir(cwd), 'state', 'tmux-hook-state.json');
}
function tmuxHookLogPath(cwd = process.cwd()): string {
return join(omxDir(cwd), 'logs', `tmux-hook-${new Date().toISOString().split('T')[0]}.jsonl`);
}
function parseConfig(raw: unknown): TmuxHookConfig {
if (!raw || typeof raw !== 'object') {
throw new Error('tmux-hook config must be a JSON object');
}
const parsed = raw as Record<string, unknown>;
if (parsed.enabled !== true && parsed.enabled !== false) {
throw new Error('`enabled` must be boolean');
}
const target = parsed.target;
if (!target || typeof target !== 'object') {
throw new Error('`target` is required');
}
const targetObj = target as Record<string, unknown>;
if (targetObj.type !== 'session' && targetObj.type !== 'pane') {
throw new Error('`target.type` must be "session" or "pane"');
}
if (typeof targetObj.value !== 'string' || targetObj.value.trim() === '') {
throw new Error('`target.value` must be a non-empty string');
}
const allowedModes = parsed.allowed_modes;
if (!Array.isArray(allowedModes) || allowedModes.length === 0 || allowedModes.some(v => typeof v !== 'string')) {
throw new Error('`allowed_modes` must be a non-empty string array');
}
View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Set "enabled": true or false exactly (unquoted, no 1/0)
- Run omx tmux-hook init to regenerate a valid config
- If templating, cast to boolean before serializing
Example fix
// before
{"enabled": "true", ...}
// after
{"enabled": true, ...} Defensive patterns
Strategy: type-guard
Validate before calling
const cfg = JSON.parse(text);
if (typeof cfg.enabled !== 'boolean') throw new Error('fix enabled before running omx'); Type guard
const isBool = (v: unknown): v is boolean => v === true || v === false;
Try / catch
try { await loadConfig(); } catch (e) { if (e instanceof Error && e.message.includes('`enabled`')) { repairConfig(); } } Prevention
- Never quote booleans in JSON config
- Use omx tmux-hook init output as the canonical template
When it happens
Trigger: Config contains "enabled": 1, "enabled": "true", or omits the key entirely (undefined fails the check).
Common situations: YAML-style habits (yes/no) carried into JSON; env-templated configs substituting strings; omitting the key assuming it defaults to true.
Related errors
- `dry_run` must be boolean
- `skip_if_scrolling` must be boolean
- tmux-hook config must be a JSON object
- `target` is required
- `target.type` must be "session" or "pane"
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/5db0ffd1ddc84755.
Report an issue: GitHub.