Yeachan-Heo/oh-my-codex · error · Error

`skip_if_scrolling` must be boolean

Error message

`skip_if_scrolling` must be boolean

What it means

The optional config field skip_if_scrolling, when present, must be strictly boolean. Unlike required fields, omission is allowed, but any non-boolean value (1/0, strings, null) fails.

Source

Thrown at src/cli/tmux-hook.ts:159

  }

  const promptTemplate = parsed.prompt_template;
  const marker = parsed.marker;
  if (typeof promptTemplate !== 'string' || promptTemplate.trim() === '') {
    throw new Error('`prompt_template` must be a non-empty string');
  }
  if (typeof marker !== 'string' || marker.trim() === '') {
    throw new Error('`marker` must be a non-empty string');
  }

  if (parsed.dry_run !== true && parsed.dry_run !== false) {
    throw new Error('`dry_run` must be boolean');
  }
  if (parsed.log_level !== 'error' && parsed.log_level !== 'info' && parsed.log_level !== 'debug') {
    throw new Error('`log_level` must be one of: error, info, debug');
  }
  if (parsed.skip_if_scrolling !== undefined && parsed.skip_if_scrolling !== true && parsed.skip_if_scrolling !== false) {
    throw new Error('`skip_if_scrolling` must be boolean');
  }

  return {
    enabled: parsed.enabled,
    target: { type: targetObj.type, value: targetObj.value },
    allowed_modes: allowedModes,
    cooldown_ms: cooldown,
    max_injections_per_session: maxInjections,
    prompt_template: promptTemplate,
    marker,
    dry_run: parsed.dry_run,
    log_level: parsed.log_level,
    skip_if_scrolling: parsed.skip_if_scrolling === false ? false : true,
  };
}

async function readValidatedConfig(cwd = process.cwd()): Promise<TmuxHookConfig> {
  const configPath = tmuxHookConfigPath(cwd);

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Use an unquoted true/false, or delete the key entirely to use the default
  2. Coerce templated values to real booleans before writing
  3. Regenerate the config to see the canonical shape

Example fix

// before
{"skip_if_scrolling": "yes"}
// after
{"skip_if_scrolling": true}
Defensive patterns

Strategy: type-guard

Validate before calling

if ('skip_if_scrolling' in cfg && cfg.skip_if_scrolling !== true && cfg.skip_if_scrolling !== false) throw new Error('bad skip_if_scrolling');

Type guard

const isOptionalBool = (v: unknown): v is boolean | undefined => v === undefined || v === true || v === false;

Try / catch

try { await loadConfig(); } catch (e) { if (e instanceof Error && e.message.includes('skip_if_scrolling')) { delete cfg.skip_if_scrolling; retry(); } }

Prevention

When it happens

Trigger: "skip_if_scrolling": "yes", 1, null, or any value that is not exactly true/false while the key exists.

Common situations: Users adding the optional flag with YAML-style yes/no; env-var templating producing strings; setting null to 'unset' it.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/7eda3fb200b0d229. Report an issue: GitHub.