pbakaus/impeccable · warning · Error

config.cspChecked, if present, must be a boolean

Error message

config.cspChecked, if present, must be a boolean

What it means

Eighth validateConfig() check: cfg.cspChecked is optional (undefined is fine), but if present it must be a boolean. cspChecked records whether the Content-Security-Policy meta was already reconciled by patchCspMeta()/revertCspMeta(); a non-boolean would mislead the journal reconciliation logic that reads it.

Source

Thrown at plugin/skills/impeccable/scripts/live-inject.mjs:472

  if (!cfg.files.every((f) => typeof f === 'string' && f.length > 0)) {
    throw new Error('config.files must contain only non-empty strings');
  }
  if (cfg.exclude !== undefined) {
    if (!Array.isArray(cfg.exclude)) {
      throw new Error('config.exclude, if present, must be a string array');
    }
    if (!cfg.exclude.every((f) => typeof f === 'string' && f.length > 0)) {
      throw new Error('config.exclude must contain only non-empty strings');
    }
  }
  if (typeof cfg.insertBefore !== 'string' && typeof cfg.insertAfter !== 'string') {
    throw new Error('config.insertBefore or config.insertAfter (string) required');
  }
  if (cfg.commentSyntax !== 'html' && cfg.commentSyntax !== 'jsx') {
    throw new Error("config.commentSyntax must be 'html' or 'jsx'");
  }
  if (cfg.cspChecked !== undefined && typeof cfg.cspChecked !== 'boolean') {
    throw new Error("config.cspChecked, if present, must be a boolean");
  }
}

// ---------------------------------------------------------------------------
// Auto-execute
// ---------------------------------------------------------------------------

const _running = process.argv[1];
if (_running?.endsWith('live-inject.mjs') || _running?.endsWith('live-inject.mjs/')) {
  enterLiveRoot();
  injectCli();
}

// Re-exported so long-standing importers (live.mjs, the adapter modules, the
// test suites) keep their entry points while the implementations live in
// live/frameworks/.
export {
  buildLiveScriptSrc,

View on GitHub (pinned to d14711ae3d)

Solutions

  1. Remove the cspChecked key if you don't need to assert CSP state — the injector manages it internally.
  2. Set it to a real JSON boolean (true/false, unquoted).
  3. Validate with `node live-inject.mjs --check`.
  4. Regenerate the config to let the injector own this field.

Example fix

// before
{ "cspChecked": "true", ... }

// after
{ "cspChecked": true, ... }
// or simply omit the key
{ "files": [...], ... }
Defensive patterns

Strategy: validation

Validate before calling

function isValidCspChecked(cfg) {
  return cfg?.cspChecked === undefined || typeof cfg.cspChecked === 'boolean';
}
if (!isValidCspChecked(cfg)) {
  cfg.cspChecked = cfg.cspChecked === 'true' || cfg.cspChecked === true;
}

Type guard

/** True when cspChecked is absent or a real boolean. */
function isOptionalBoolean(value) {
  return value === undefined || typeof value === 'boolean';
}

Try / catch

try {
  validateConfig(cfg);
} catch (err) {
  if (/cspChecked/.test(err.message)) {
    cfg.cspChecked = undefined; // let the injector own it
    validateConfig(cfg);
  }
  throw err;
}

Prevention

When it happens

Trigger: "cspChecked": "true" (string), 1, "yes", null. The field is correctly omitted by setup unless CSP work has run, so a non-boolean value typically comes from hand-editing.

Common situations: User added the field manually with a stringy boolean; a config-merge tool coerced true to 'true'; YAML-to-JSON conversion mangled the type.

Related errors


AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13). Data as JSON: /api/errors/63a1563cdca0fe84. Report an issue: GitHub.