{"record":{"id":"e8a4ae1fab0613bb","repo":"affaan-m/ECC","slug":"command-args-join-failed-erroroutput","errorCode":null,"errorMessage":"${command} ${args.join(' ')} failed${errorOutput ? `: ${errorOutput}` : ''}","messagePattern":"(.+?) (.+?) failed(.+?)` : ''\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/auto-update.js","lineNumber":170,"sourceCode":"\n  return normalized;\n}\n\nfunction runExternalCommand(command, args, options = {}) {\n  const result = spawnSync(command, args, {\n    cwd: options.cwd,\n    env: options.env || process.env,\n    encoding: 'utf8',\n    maxBuffer: 10 * 1024 * 1024\n  });\n\n  if (result.error) {\n    throw result.error;\n  }\n\n  if (typeof result.status === 'number' && result.status !== 0) {\n    const errorOutput = (result.stderr || result.stdout || '').trim();\n    throw new Error(`${command} ${args.join(' ')} failed${errorOutput ? `: ${errorOutput}` : ''}`);\n  }\n\n  return result;\n}\n\nfunction runAutoUpdate(options = {}, dependencies = {}) {\n  const discover = dependencies.discoverInstalledStates || discoverInstalledStates;\n  const execute = dependencies.runExternalCommand || runExternalCommand;\n  const homeDir = options.homeDir || process.env.HOME || os.homedir();\n  const projectRoot = options.projectRoot || process.cwd();\n  const requestedRepoRoot = options.repoRoot ? validateRepoRoot(options.repoRoot) : null;\n  const records = discover({\n    homeDir,\n    projectRoot,\n    targets: options.targets\n  }).filter(record => record.exists);\n\n  const results = [];","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/auto-update.js#L152-L188","documentation":"before_settle() (alias require_trust) is a policy gate that raises AuraUntrusted when the AURA verdict for the counterparty DID is not in the allowed set. By default only 'trusted' and 'caution' pass; 'high_risk', 'new', and 'unknown' are rejected. fail_open=True only excuses a transport failure (unreachable AURA) — a reachable AURA that returns 'unknown' is still rejected, because absence of evidence is not evidence of trust. The raised exception carries the full AuraVerdict for inspection.","triggerScenarios":"Counterparty has verdict 'high_risk'; counterparty is brand new (verdict 'new') under the default allow=('trusted','caution'); AURA is reachable but returns 'unknown' (no history); fail_open=False and AURA is unreachable (network down).","commonSituations":"Onboarding a new counterparty agent without widening `allow`; attempting to settle with an agent that AURA has flagged; AURA service is down and fail_open was left at its default False.","solutions":["Inspect e.verdict (the AuraUntrusted exception carries it) to see the verdict, reason, and score before deciding.","For legitimate onboarding, widen the allow set explicitly: before_settle(did, allow=('trusted','caution','new')).","If you intentionally want transport failures to pass, set fail_open=True — but understand this only excuses unreachable AURA, never a reachable 'unknown'.","If the verdict is 'high_risk', abort the settlement; do not widen allow to include it."],"exampleFix":"# before\nbefore_settle(counterparty_did)  # raises AuraUntrusted for 'new'\n\n# after\ntry:\n    before_settle(counterparty_did)\nexcept AuraUntrusted as e:\n    if e.verdict.verdict == 'new' and is_onboarding:\n        before_settle(counterparty_did, allow=('trusted','caution','new'))\n    else:\n        abort(str(e))","handlingStrategy":"try-catch","validationCode":"# Inspect the verdict first to decide whether to widen `allow` before gating.\nv = aura_verdict(did)\nif v.verdict not in ('trusted', 'caution') and is_onboarding_flow and v.verdict == 'new':\n    allow = ('trusted', 'caution', 'new')\nelse:\n    allow = ('trusted', 'caution')\nbefore_settle(did, allow=allow, fail_open=fail_open)","typeGuard":"from integrations.aura.adapter import AuraUntrusted\n\ndef is_aura_untrusted(e) -> bool:\n    return isinstance(e, AuraUntrusted)","tryCatchPattern":"from integrations.aura.adapter import before_settle, AuraUntrusted\n\ntry:\n    before_settle(counterparty_did)\n    settle(counterparty_did)\nexcept AuraUntrusted as e:\n    v = e.verdict  # full AuraVerdict: .verdict, .reason, .score, .reachable\n    log.warning('trust gate blocked %s (%s): %s', v.did, v.verdict, v.reason)\n    abort_settlement(v)","preventionTips":["Never widen `allow` to include 'high_risk' — that defeats the gate.","Use fail_open=True only for non-critical paths where an AURA outage should not block business.","Log e.verdict.reason on every rejection so you can audit trust decisions later.","Remember fail_open excuses only transport failures, never a reachable 'unknown'."],"tags":["trust","aura","policy","security","fail-closed"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}