{"record":{"id":"eb3544de1112355a","repo":"affaan-m/ECC","slug":"command-commandname-terminated-by-signal-re","errorCode":null,"errorMessage":"Command \"${commandName}\" terminated by signal ${result.signal}","messagePattern":"Command \"(.+?)\" terminated by signal (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/ecc.js","lineNumber":301,"sourceCode":"\n  if (result.error) {\n    throw result.error;\n  }\n\n  if (result.stdout) {\n    process.stdout.write(result.stdout);\n  }\n\n  if (result.stderr) {\n    process.stderr.write(result.stderr);\n  }\n\n  if (typeof result.status === 'number') {\n    return result.status;\n  }\n\n  if (result.signal) {\n    throw new Error(`Command \"${commandName}\" terminated by signal ${result.signal}`);\n  }\n\n  return 1;\n}\n\nfunction main() {\n  try {\n    const resolution = resolveCommand(process.argv);\n\n    if (resolution.mode === 'help') {\n      showHelp(0);\n    }\n\n    if (resolution.mode === 'help-command') {\n      if (!resolution.command) {\n        showHelp(0);\n      }\n","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/ecc.js#L283-L319","documentation":"Thrown by runCommand() in scripts/ecc.js when a spawned child process (the actual command script) is terminated by an OS signal rather than exiting with a numeric status code. This happens when result.status is not a number but result.signal is set, indicating the process was killed externally (e.g. SIGTERM, SIGKILL, SIGSEGV).","triggerScenarios":"The child Node.js process running a command script receives a signal: OOM killer sends SIGKILL (memory exhaustion), user presses Ctrl+C producing SIGINT, the system sends SIGTERM during shutdown, or a segfault produces SIGSEGV. spawnSync returns with signal set and status null/undefined.","commonSituations":"Out-of-memory conditions when running heavy commands (e.g. catalog generation on large repos), manual process termination, CI environment resource limits, or a crash/segfault in a native module used by a command script.","solutions":["Check if the system killed the process due to memory limits (dmesg or CI logs for OOM).","Re-run the specific command directly to see if it crashes: `node scripts/<command-script>.js <args>`.","If SIGINT, ensure you are not accidentally sending Ctrl+C or that a parent process is not terminating children.","If SIGSEGV, investigate native module crashes or Node.js version incompatibility.","Increase available memory: `node --max-old-space-size=4096 scripts/ecc.js <command>`."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const exitCode = runCommand(cmd, args);\n  process.exitCode = exitCode;\n} catch (err) {\n  if (err.message.includes('terminated by signal')) {\n    const sig = err.message.match(/signal (\\w+)/)?.[1];\n    if (sig === 'SIGKILL') console.error('Process killed (likely OOM). Increase --max-old-space-size.');\n    else console.error(`Process killed by ${sig}`);\n    process.exit(137);\n  }\n  throw err;\n}","preventionTips":["Monitor memory usage of heavy commands and increase --max-old-space-size proactively.","Run resource-intensive commands in CI with adequate memory limits.","Log the signal name to distinguish OOM (SIGKILL) from user interrupts (SIGINT)."],"tags":["process","signal","spawn","system-resource"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}