affaan-m/ECC · error · Error
Canonical session snapshot requires ${fieldPath} to be an ar
Error message
Canonical session snapshot requires ${fieldPath} to be an array of strings What it means
Thrown by the ensureArrayOfStrings helper when a field that must be an array of strings is not an array or contains non-string elements. Applied to workers[i].intent.seedPaths and the three outputs arrays (summary, validation, remainingRisks).
Source
Thrown at scripts/lib/session-adapters/canonical-session.js:59
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) {
if (typeof updated !== 'string' || updated.length === 0) return null;
const ms = Date.parse(updated);
return Number.isNaN(ms) ? null : ms;
}
function deriveWorkerHealth(rawWorker) {View on GitHub (pinned to 01e15490f0)
Solutions
- Default to [] and filter to strings when building: (Array.isArray(x) ? x : []).filter(s => typeof s === 'string').
- Ensure source adapters always emit arrays, even single-item ones.
- Coerce known string fields into [value] when the source provides a scalar.
Example fix
// before
outputs: { summary: handoff.summary, ... } // handoff.summary is a string or null
// after
const toStrArr = v => (Array.isArray(v) ? v.filter(s => typeof s === 'string') : []);
outputs: { summary: toStrArr(handoff.summary), ... } Defensive patterns
Strategy: validation
Validate before calling
const strArr = v => (Array.isArray(v) ? v.filter(s => typeof s === 'string') : []); // apply to seedPaths, summary, validation, remainingRisks
Type guard
function isStringArray(v) {
return Array.isArray(v) && v.every(s => typeof s === 'string');
} Prevention
- Default array fields to [] and filter to strings at the adapter boundary.
- Wrap scalar strings as [value] when the source provides a single item.
When it happens
Trigger: A outputs.summary set to a string instead of an array; a seedPaths array containing a number or object; a field set to null where an array is required; an adapter that sometimes emits a single string instead of a one-element array.
Common situations: A source handoff where summary is a comma-separated string rather than a list; a transform that produced mixed-type array elements; missing field defaulting to null instead of []; version skew between adapter and schema.
Related errors
- Canonical session snapshot requires ${fieldPath} to be a non
- Canonical session snapshot requires ${fieldPath} to be a str
- Canonical session snapshot requires ${fieldPath} to be a str
- Canonical session snapshot requires ${fieldPath} to be a boo
- Canonical session snapshot requires ${fieldPath} to be a non
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/e4552d2eed77fadd.
Report an issue: GitHub.