affaan-m/ECC · error · Error
Unknown argument: ${arg}
Error message
Unknown argument: ${arg} What it means
After successfully parsing args (or receiving a non-string value), the workflow requires the result to be a non-null object. This throw fires when the parsed value is a primitive (number, boolean, string), null, or an array — anything that is not a plain object holding a `diff` field. The review contract is object-shaped; an array or scalar cannot satisfy it.
Source
Thrown at scripts/auto-update.js:47
};
for (let index = 0; index < args.length; index += 1) {
const arg = args[index];
if (arg === '--target') {
parsed.targets.push(args[index + 1] || null);
index += 1;
} else if (arg === '--repo-root') {
parsed.repoRoot = args[index + 1] || null;
index += 1;
} else if (arg === '--dry-run') {
parsed.dryRun = true;
} else if (arg === '--json') {
parsed.json = true;
} else if (arg === '--help' || arg === '-h') {
parsed.help = true;
} else {
throw new Error(`Unknown argument: ${arg}`);
}
}
return parsed;
}
function deriveRepoRootFromState(state) {
const operations = Array.isArray(state && state.operations) ? state.operations : [];
for (const operation of operations) {
if (typeof operation.sourcePath !== 'string' || !operation.sourcePath.trim()) {
continue;
}
if (typeof operation.sourceRelativePath !== 'string' || !operation.sourceRelativePath.trim()) {
continue;
}
View on GitHub (pinned to 01e15490f0)
Solutions
- Wrap the payload in an object with a `diff` key: { diff: unifiedDiff, changedFiles: [...] }.
- If you previously passed a bare string, move that string into the `diff` property.
- Add a runtime type check in the caller: typeof payload === 'object' && payload !== null && !Array.isArray(payload).
Example fix
// before
orchReview('--- a\n+++ b\n'); // bare diff string parses to a string, not object
// after
orchReview({ diff: '--- a\n+++ b\n', changedFiles: ['b'] }); Defensive patterns
Strategy: type-guard
Validate before calling
// Confirm the payload is a non-null, non-array object before calling.
const ok = typeof input === 'object' && input !== null && !Array.isArray(input);
if (!ok) throw new Error('orch-review payload must be a plain object with a diff field'); Type guard
function isReviewPayload(v) {
return typeof v === 'object' && v !== null && !Array.isArray(v) && typeof v.diff === 'string';
} Try / catch
try {
orchReview(payload);
} catch (e) {
if (e.message === 'orch-review: args must be an object') {
payload = { diff: String(payload) }; // wrap a bare value, then retry
orchReview(payload);
}
} Prevention
- Always wrap your review data in { diff, changedFiles } — never pass a bare diff or array.
- Add a type check in the caller so mis-shaped payloads fail there, not inside the gate.
When it happens
Trigger: Passing args as a JSON array string '["file.js"]'; passing a bare diff string 'orchReview("--- a\n...")'; passing a number/boolean; passing args = null.
Common situations: Caller passes the raw diff text directly instead of wrapping it in { diff: ... }; caller passes a list of files instead of the expected object envelope; args defaults to null somewhere upstream.
Related errors
- ECC_PROJECT_DIR must be a child path within /workspace.
- Invalid ECC repo root: missing package.json at ${packageJson
- Invalid ECC repo root: missing install script at ${installAp
- Unable to infer ECC repo root from install-state operations
- --json may only be provided once
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/926789182a1251fe.
Report an issue: GitHub.