pbakaus/impeccable · error · Error

config.cspChecked, if present, must be a boolean

Error message

config.cspChecked, if present, must be a boolean

What it means

Thrown by validateConfig() in live-inject.mjs when cfg.cspChecked is present but not a boolean. cspChecked is an optional flag indicating the author has already verified the injected snippet against the page's Content-Security-Policy; the guard only rejects wrong-typed values (string 'true', number 1), undefined is allowed. It runs before any file writes.

Source

Thrown at skill/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. Set 'cspChecked' to a real JSON boolean: "cspChecked": true (or false).
  2. If you have not done a CSP review, omit the key entirely rather than passing a placeholder.

Example fix

// before
"cspChecked": "true"
// after
"cspChecked": true
Defensive patterns

Strategy: type-guard

Validate before calling

if (cfg.cspChecked !== undefined && typeof cfg.cspChecked !== 'boolean') {
  // coerce common mistakes
  cfg.cspChecked = cfg.cspChecked === 'true' || cfg.cspChecked === 1;
}

Type guard

function isOptionalBoolean(v: unknown): v is boolean | undefined {
  return v === undefined || typeof v === 'boolean';
}

Prevention

When it happens

Trigger: validateConfig runs on a config containing "cspChecked": "true", "cspChecked": 1, or "cspChecked": "yes". The undefined case (key absent) is valid and means 'not yet checked'.

Common situations: Config generated by a tool that serializes booleans as strings; author wrote cspChecked: "true" in a JSON template; copy-paste from YAML configs that coerce unquoted true to string.

Related errors


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