affaan-m/ECC · error · Error

Canonical session snapshot requires ${fieldPath} to be a boo

Error message

Canonical session snapshot requires ${fieldPath} to be a boolean

What it means

Thrown by the ensureBoolean helper when a field that must be a boolean is not. Applied to workers[i].runtime.active and workers[i].runtime.dead — these drive health derivation and must be strict booleans.

Source

Thrown at scripts/lib/session-adapters/canonical-session.js:53

    throw new Error(`Canonical session snapshot requires ${fieldPath} to be a non-empty string`);
  }
}

function ensureStringAllowEmpty(value, fieldPath) {
  if (typeof value !== 'string') {
    throw new Error(`Canonical session snapshot requires ${fieldPath} to be a string`);
  }
}

function ensureOptionalString(value, fieldPath) {
  if (value !== null && value !== undefined && typeof value !== 'string') {
    throw new Error(`Canonical session snapshot requires ${fieldPath} to be a string or null`);
  }
}

function ensureBoolean(value, fieldPath) {
  if (typeof value !== 'boolean') {
    throw new Error(`Canonical session snapshot requires ${fieldPath} to be a boolean`);
  }
}

function ensureArrayOfStrings(value, fieldPath) {
  if (!Array.isArray(value) || value.some(item => typeof item !== 'string')) {
    throw new Error(`Canonical session snapshot requires ${fieldPath} to be an array of strings`);
  }
}

function ensureInteger(value, fieldPath) {
  if (!Number.isInteger(value) || value < 0) {
    throw new Error(`Canonical session snapshot requires ${fieldPath} to be a non-negative integer`);
  }
}

const STALE_THRESHOLD_MS = 5 * 60 * 1000;

function parseUpdatedMs(updated) {

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Always coerce with Boolean() when building runtime: active: Boolean(pane && pane.active).
  2. Ensure source adapters emit strict booleans for these fields.
  3. Validate fixtures before persisting a snapshot.

Example fix

// before
runtime: { active: pane.active, dead: pane.dead, ... } // pane.active is 0/1

// after
runtime: { active: Boolean(pane && pane.active), dead: Boolean(pane && pane.dead), ... }
Defensive patterns

Strategy: type-guard

Validate before calling

// Force strict booleans when constructing runtime.
active: Boolean(pane && pane.active),
dead: Boolean(pane && pane.dead),

Type guard

function isBool(v) { return typeof v === 'boolean'; }

Prevention

When it happens

Trigger: A worker.runtime.active set to 1, 'true', undefined, or null; runtime.dead set to a truthy non-boolean. Often happens when an adapter forwards a source field without Boolean() coercion.

Common situations: A source pane record where active is 0/1 instead of false/true; an adapter that left active as undefined; a JSON parse that produced a number where a boolean was expected; test data using truthy integers.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/c711ab6e5c531278. Report an issue: GitHub.