affaan-m/ECC · error · Error

Formatter exited with status

Error message

Formatter exited with status ${result.status}

What it means

The spawned formatter child process (Biome or Prettier) terminated with a nonzero exit status, meaning formatting failed. The hook throws to surface the formatter's failure instead of silently returning unformatted content.

Solutions

  1. Run the same formatter manually on the file to see the underlying parse/style error.
  2. Fix the syntax error in the file, then save again so the hook re-runs the formatter.
  3. Verify the formatter binary is installed (e.g. npx prettier --version).

Example fix

npx prettier --write path/to/file.ts  # inspect the reported error, fix it, save again
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at scripts/hooks/post-edit-format.js:70 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@06c5e118c4 (2026-08-18). Data as JSON: /api/errors/2862db27f9d7c545. Report an issue: GitHub.

Appendix: 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 06c5e118c4)