Automattic/harper · error

isolateEnglish path must be a boolean.

Error message

isolateEnglish path must be a boolean.

What it means

`from_lsp_config` requires the `isolateEnglish` setting to be a JSON boolean when present; it is copied directly into `isolate_english`. Any non-boolean value (string "true", number, null) aborts config parsing with this error. As with statsPath, the message text says "path" though the setting is a boolean flag.

Source

Thrown at harper-ls/src/config.rs:176

        }

        if let Some(v) = value.get("diagnosticSeverity") {
            base.diagnostic_severity = serde_json::from_value(v.clone())?;
        }

        if let Some(v) = value.get("dialect") {
            base.dialect = serde_json::from_value(v.clone())?;
        }

        if let Some(v) = value.get("codeActions") {
            base.code_action_config = CodeActionConfig::from_lsp_config(v.clone())?;
        }

        if let Some(v) = value.get("isolateEnglish") {
            if let Value::Bool(v) = v {
                base.isolate_english = *v;
            } else {
                bail!("isolateEnglish path must be a boolean.");
            }
        }

        if let Some(v) = value.get("maxFileLength") {
            base.max_file_length = serde_json::from_value(v.clone())?;
        }

        if let Some(v) = value.get("markdown")
            && let Some(v) = v.get("IgnoreLinkTitle")
        {
            base.markdown_options.ignore_link_title = serde_json::from_value(v.clone())?;
        }

        if let Some(v) = value.get("excludePatterns") {
            let Some(a) = v.as_array() else {
                bail!("excludePatterns must be an array.");
            };

View on GitHub (pinned to 5fe7d5ab76)

Solutions

  1. Change the value to an unquoted JSON boolean: true or false.
  2. Remove the key to use the default behavior.
  3. Fix any config generator or template that stringifies booleans.

Example fix

// before
{ "isolateEnglish": "true" }
// after
{ "isolateEnglish": true }
Defensive patterns

Strategy: validation

Validate before calling

if ('isolateEnglish' in cfg && typeof cfg.isolateEnglish !== 'boolean') {
  throw new TypeError(`isolateEnglish must be a boolean, got ${typeof cfg.isolateEnglish}`);
}

Type guard

function isIsolateEnglishOk(cfg) {
  return !('isolateEnglish' in cfg) || typeof cfg.isolateEnglish === 'boolean';
}

Prevention

When it happens

Trigger: Config payload with `isolateEnglish` as the string "true"/"false", a number 0/1, or null instead of a real JSON boolean.

Common situations: Users quoting boolean values in settings files (`"isolateEnglish": "true"`), environment-driven config generation casting booleans to strings, or YAML/TOML-to-JSON conversions that turned the flag into a string.

Related errors


AI-assisted analysis of Automattic/harper@5fe7d5ab76 (2026-09-06). Data as JSON: /api/errors/b2a92ca33710ef93. Report an issue: GitHub.