affaan-m/ECC · warning
Formatter exited with status ${result.status}
Error message
Formatter exited with status ${result.status} What it means
When the Windows .cmd formatter is spawned and exits with a non-zero status but writes nothing to stderr, the hook throws a status-only message. Like the other formatter errors it is caught and swallowed, so the edit is not blocked; the file is simply left unformatted.
Source
Thrown at scripts/hooks/post-edit-format.js:70
// Biome: `check --write` = format + lint in one pass
// Prettier: `--write` = format only
const args = formatter === 'biome' ? [...resolved.prefix, 'check', '--write', resolvedFilePath] : [...resolved.prefix, '--write', resolvedFilePath];
if (process.platform === 'win32' && resolved.bin.endsWith('.cmd')) {
// Windows: .cmd files require shell to execute. Guard against
// command injection by rejecting paths with shell metacharacters.
if (UNSAFE_PATH_CHARS.test(resolvedFilePath)) {
throw new Error('File path contains unsafe shell characters');
}
const result = spawnSync(resolved.bin, args, {
cwd: projectRoot,
shell: true,
stdio: 'pipe',
timeout: 15000
});
if (result.error) throw result.error;
if (typeof result.status === 'number' && result.status !== 0) {
throw new Error(result.stderr?.toString() || `Formatter exited with status ${result.status}`);
}
} else {
execFileSync(resolved.bin, args, {
cwd: projectRoot,
stdio: ['pipe', 'pipe', 'pipe'],
timeout: 15000
});
}
} catch {
// Formatter not installed, file missing, or failed — non-blocking
}
}
} catch {
// Invalid input — pass through
}
return rawInput;
}View on GitHub (pinned to 01e15490f0)
Solutions
- Run the formatter manually on the file to see the real diagnostic
- Fix any syntax errors in the edited file
- Reinstall or upgrade the formatter (biome/prettier) in the project
Defensive patterns
Strategy: try-catch
Validate before calling
const { spawnSync } = require('child_process');
function formatterOkay(bin, projectRoot) {
const r = spawnSync(bin, ['--version'], { cwd: projectRoot });
return !r.error && r.status === 0;
} Type guard
function isFormatterStatusZero(result) {
return result && !result.error && (typeof result.status !== 'number' || result.status === 0);
} Try / catch
try { runFormatter(bin, args); }
catch (err) {
if (/Formatter exited with status/.test(err.message)) {
console.warn('Formatter failed; run it manually to see diagnostics:', err.message);
return; // non-blocking
}
throw err;
} Prevention
- Run the formatter manually on a failing file to surface the real diagnostic
- Keep formatter versions current so new syntax is supported
- Do not rely on the hook for syntax validation; fix parse errors first
When it happens
Trigger: Biome or Prettier exits non-zero on the edited file (syntax error, unsupported syntax, config error) while emitting no stderr output; or the formatter binary is partially broken on Windows.
Common situations: Editing a file with a syntax error the formatter cannot parse, a formatter version that chokes on a new syntax feature, or a corrupt formatter install that exits non-zero silently.
Related errors
- File path contains unsafe shell characters
- Path traversal rejected: ${relPath}
- Path traversal rejected: ${relPath}
- Claude Code command contains characters that are unsafe for
- Invalid hooks config at ${hooksSourcePath}: expected "hooks"
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/2862db27f9d7c545.
Report an issue: GitHub.