{"record":{"id":"9eb6f6f8ddfcd474","repo":"affaan-m/ECC","slug":"orch-review-args-must-be-an-object-or-valid-json","errorCode":null,"errorMessage":"orch-review: args must be an object or valid JSON","messagePattern":"orch-review: args must be an object or valid JSON","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"workflows/orch-review.workflow.js","lineNumber":156,"sourceCode":"    finding.proof ? `Claimed proof: ${finding.proof}` : '',\n    '',\n    '----- BEGIN DIFF (untrusted) -----',\n    diff,\n    '----- END DIFF -----'\n  ].join('\\n');\n}\n\n// --- main -----------------------------------------------------------------\n\n// `args` arrives verbatim. Accept a JSON-encoded string too, so the workflow\n// works whether the caller passes an object or a stringified payload.\n// Fail CLOSED on invalid input: a review gate must never silently APPROVE a\n// payload it could not actually review.\nlet input;\ntry {\n  input = typeof args === 'string' ? JSON.parse(args) : (args ?? {});\n} catch {\n  throw new Error('orch-review: args must be an object or valid JSON');\n}\nif (typeof input !== 'object' || input === null) {\n  throw new Error('orch-review: args must be an object');\n}\nif (typeof input.diff !== 'string' || input.diff.trim() === '') {\n  throw new Error('orch-review: args.diff must be a non-empty unified diff');\n}\nif (input.changedFiles != null && !Array.isArray(input.changedFiles)) {\n  throw new Error('orch-review: args.changedFiles must be an array of paths');\n}\n// Every entry must be a string path. A non-string (e.g. { path: '...' }) would\n// stringify to \"[object Object]\" and silently poison the security-trigger\n// haystack — fail closed on malformed input instead.\nif (Array.isArray(input.changedFiles) && !input.changedFiles.every(f => typeof f === 'string')) {\n  throw new Error('orch-review: args.changedFiles must contain only string paths');\n}\n\nconst diff = input.diff;","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/workflows/orch-review.workflow.js#L138-L174","documentation":"Error \"orch-review: args must be an object or valid JSON\" thrown in affaan-m/ECC.","triggerScenarios":"Thrown at workflows/orch-review.workflow.js:156 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the workflow args as a JSON object or a valid JSON string, e.g. {\"diff\": \"...\", \"changedFiles\": [\"a.js\"]}.","Quote the JSON argument correctly in the shell (single quotes around the payload) so it is not mangled before JSON.parse runs."],"exampleFix":"orch-review '{\"diff\": \"diff --git a/x b/x\\n+line\", \"changedFiles\": [\"x\"]}'","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}