affaan-m/ECC · error · Error

orch-review: args must be an object or valid JSON

Error message

orch-review: args must be an object or valid JSON

What it means

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

Source

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

    finding.proof ? `Claimed proof: ${finding.proof}` : '',
    '',
    '----- BEGIN DIFF (untrusted) -----',
    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;

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Pass the workflow args as a JSON object or a valid JSON string, e.g. {"diff": "...", "changedFiles": ["a.js"]}.
  2. Quote the JSON argument correctly in the shell (single quotes around the payload) so it is not mangled before JSON.parse runs.

Example fix

orch-review '{"diff": "diff --git a/x b/x\n+line", "changedFiles": ["x"]}'

When it happens

Trigger: Thrown at workflows/orch-review.workflow.js:156 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/9eb6f6f8ddfcd474. Report an issue: GitHub.