affaan-m/ECC · error · Error

orch-review: args must be an object

Error message

orch-review: args must be an object

What it means

Error "orch-review: args must be an object" thrown in affaan-m/ECC.

Source

Thrown at workflows/orch-review.workflow.js:159

    diff,
    '----- END DIFF -----'
  ].join('\n');
}

// --- main -----------------------------------------------------------------

// `args` arrives verbatim. Accept a JSON-encoded string too, so the workflow
// works whether the caller passes an object or a stringified payload.
// Fail CLOSED on invalid input: a review gate must never silently APPROVE a
// payload it could not actually review.
let input;
try {
  input = typeof args === 'string' ? JSON.parse(args) : (args ?? {});
} catch {
  throw new Error('orch-review: args must be an object or valid JSON');
}
if (typeof input !== 'object' || input === null) {
  throw new Error('orch-review: args must be an object');
}
if (typeof input.diff !== 'string' || input.diff.trim() === '') {
  throw new Error('orch-review: args.diff must be a non-empty unified diff');
}
if (input.changedFiles != null && !Array.isArray(input.changedFiles)) {
  throw new Error('orch-review: args.changedFiles must be an array of paths');
}
// Every entry must be a string path. A non-string (e.g. { path: '...' }) would
// stringify to "[object Object]" and silently poison the security-trigger
// haystack — fail closed on malformed input instead.
if (Array.isArray(input.changedFiles) && !input.changedFiles.every(f => typeof f === 'string')) {
  throw new Error('orch-review: args.changedFiles must contain only string paths');
}

const diff = input.diff;
const haystack = `${diff}\n${(input.changedFiles || []).join('\n')}`;

// Build the review dimensions immutably. Quality always runs; language +

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Wrap the review payload in an object; bare strings, numbers, or arrays are rejected.
  2. Ensure the top-level JSON value is an object with a 'diff' key, not a JSON array or scalar.

Example fix

// bad: '["file.js"]'
// good: '{"diff": "...", "changedFiles": ["file.js"]}'

When it happens

Trigger: Thrown at workflows/orch-review.workflow.js:159 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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