affaan-m/ECC · error · Error

failed ` : ''}

Error message

${command} ${args.join(' ')} failed${errorOutput ? `: ${errorOutput}` : ''}

What it means

scripts/auto-update.js's runExternalCommand wraps child_process execution. When a spawned CLI process exits with a nonzero status, the wrapper throws an Error whose message embeds the command line and the trimmed stderr (or stdout) output, so the underlying tool's own diagnostic is preserved.

Solutions

  1. Read the stderr excerpt appended to the message — it is the child tool's own error, fix that root cause
  2. Re-run the failing command manually (command + args from the message) to reproduce and see full output
  3. Check network/auth for git or npm operations (credentials, VPN, registry status)
  4. Ensure the working directory is a valid git repo before running auto-update

Example fix

// before (from a shell)
node scripts/auto-update.js
// Error: git pull failed: fatal: not a git repository...
// after
# run from the repo root, or pass the repo root explicitly
cd /path/to/ECC && node scripts/auto-update.js
Defensive patterns

Strategy: try-catch

Validate before calling

const result = cp.spawnSync(cmd, args, { encoding: 'utf8' });
if (result.status !== 0) {
  console.error(`Skipping update: ${cmd} exited ${result.status}: ${result.stderr}`);
  return;
}

Type guard

function isSuccessfulSpawn(result) {
  return result.error == null && result.status === 0;
}

Try / catch

try {
  runExternalCommand('git', ['pull']);
} catch (err) {
  console.error('auto-update command failed:', err.message);
  // inspect embedded stderr excerpt for the child tool's root cause
}

Prevention

When it happens

Trigger: Any external command spawned via runExternalCommand (e.g. git, npm) exits with result.status !== 0; result.error is null but the process reported failure through its exit code.

Common situations: git fetch/pull failing due to network issues or auth prompts, npm update failing because of lockfile conflicts or registry outages, running auto-update outside a git checkout so git commands fail.

Understand the failure class

Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/e8a4ae1fab0613bb. Report an issue: GitHub.

Appendix: source

Thrown at scripts/auto-update.js:178

  return normalized;
}

function runExternalCommand(command, args, options = {}) {
  const result = spawnSync(command, args, {
    cwd: options.cwd,
    env: options.env || process.env,
    encoding: 'utf8',
    maxBuffer: 10 * 1024 * 1024
  });

  if (result.error) {
    throw result.error;
  }

  if (typeof result.status === 'number' && result.status !== 0) {
    const errorOutput = (result.stderr || result.stdout || '').trim();
    throw new Error(`${command} ${args.join(' ')} failed${errorOutput ? `: ${errorOutput}` : ''}`);
  }

  return result;
}

function legacyMigrationWarning(record) {
  if (record.legacyLayout === 'opencode') {
    return 'Found only a legacy OpenCode ~/.opencode install-state. Run the OpenCode installer once to migrate it to the configured OpenCode directory before auto-updating.';
  }
  return 'Found only a legacy Antigravity .agent install-state. Run the Antigravity installer once to migrate it to .agents before auto-updating.';
}

function runAutoUpdate(options = {}, dependencies = {}) {
  const discover = dependencies.discoverInstalledStates || discoverInstalledStates;
  const execute = dependencies.runExternalCommand || runExternalCommand;
  const homeDir = options.homeDir || process.env.HOME || os.homedir();
  const projectRoot = options.projectRoot || process.cwd();
  const requestedRepoRoot = options.repoRoot ? validateRepoRoot(options.repoRoot) : null;

View on GitHub (pinned to 8321021c54)