{"record":{"id":"2862db27f9d7c545","repo":"affaan-m/ECC","slug":"formatter-exited-with-status-result-status","errorCode":null,"errorMessage":"Formatter exited with status ${result.status}","messagePattern":"Formatter exited with status (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/hooks/post-edit-format.js","lineNumber":70,"sourceCode":"        // Biome: `check --write` = format + lint in one pass\n        // Prettier: `--write` = format only\n        const args = formatter === 'biome' ? [...resolved.prefix, 'check', '--write', resolvedFilePath] : [...resolved.prefix, '--write', resolvedFilePath];\n\n        if (process.platform === 'win32' && resolved.bin.endsWith('.cmd')) {\n          // Windows: .cmd files require shell to execute. Guard against\n          // command injection by rejecting paths with shell metacharacters.\n          if (UNSAFE_PATH_CHARS.test(resolvedFilePath)) {\n            throw new Error('File path contains unsafe shell characters');\n          }\n          const result = spawnSync(resolved.bin, args, {\n            cwd: projectRoot,\n            shell: true,\n            stdio: 'pipe',\n            timeout: 15000\n          });\n          if (result.error) throw result.error;\n          if (typeof result.status === 'number' && result.status !== 0) {\n            throw new Error(result.stderr?.toString() || `Formatter exited with status ${result.status}`);\n          }\n        } else {\n          execFileSync(resolved.bin, args, {\n            cwd: projectRoot,\n            stdio: ['pipe', 'pipe', 'pipe'],\n            timeout: 15000\n          });\n        }\n      } catch {\n        // Formatter not installed, file missing, or failed — non-blocking\n      }\n    }\n  } catch {\n    // Invalid input — pass through\n  }\n\n  return rawInput;\n}","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/affaan-m/ECC/blob/06c5e118c4d3e6c3b7f9445f973a2194c82de193/scripts/hooks/post-edit-format.js#L52-L88","documentation":"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.","triggerScenarios":"Thrown at scripts/hooks/post-edit-format.js:70 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the same formatter manually on the file to see the underlying parse/style error.","Fix the syntax error in the file, then save again so the hook re-runs the formatter.","Verify the formatter binary is installed (e.g. npx prettier --version)."],"exampleFix":"npx prettier --write path/to/file.ts  # inspect the reported error, fix it, save again","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06c5e118c4d3e6c3b7f9445f973a2194c82de193","analyzedAt":"2026-08-18T11:27:13.915Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}