{"record":{"id":"6c6c1108daf231b2","repo":"mihomo-party-org/clash-party","slug":"core-process-watchdog-exited-unexpectedly-code","errorCode":null,"errorMessage":"Core process watchdog exited unexpectedly, code: ${code}, signal: ${signal}","messagePattern":"Core process watchdog exited unexpectedly, code: (.+?), signal: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/main/core/manager.ts","lineNumber":215,"sourceCode":"\n  const watchdogStdin = watchdogProcess.stdin as typeof watchdogProcess.stdin & {\n    unref?: () => void\n  }\n  watchdogStdin.unref?.()\n  watchdogProcess.unref()\n\n  watchdogProcess.once('error', (error) => {\n    if (coreProcessWatchdog?.process === watchdogProcess) {\n      coreProcessWatchdog = null\n    }\n    watchdogProcess.stdin.destroy()\n    managerLogger.warn('Failed to start core process watchdog', error)\n  })\n  watchdogProcess.once('exit', (code, signal) => {\n    if (coreProcessWatchdog?.process !== watchdogProcess) return\n\n    coreProcessWatchdog = null\n    managerLogger.warn(\n      `Core process watchdog exited unexpectedly, code: ${code}, signal: ${signal}`\n    )\n  })\n}\n\nfunction shellQuote(value: string): string {\n  return `'${value.replace(/'/g, \"'\\\\''\")}'`\n}\n\nfunction hookTouchCommand(file: string): string {\n  return process.platform === 'win32' ? `type nul > ${file}` : `: > ${shellQuote(file)}`\n}\n\nfunction coreHookDir(): string {\n  if (process.platform === 'win32' && process.env.ProgramData) {\n    return path.join(process.env.ProgramData, 'mihomo-party', 'core-hooks')\n  }\n","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/mihomo-party-org/clash-party/blob/911e090537acdf7c50bee1c3aebecc2ef119a8b5/src/main/core/manager.ts#L197-L233","documentation":"The app spawns a helper watchdog process that monitors the core (mihomo) child process. This log line is emitted when the watchdog itself exits without being told to — an unexpected exit with a non-null exit code or signal. It means core crash auto-restart protection is degraded until the watchdog is restarted (typically on next core start).","triggerScenarios":"Watchdog binary crashes (bug, missing/broken executable, incompatible platform binary); the OS kills it (OOM killer, resource limits); a dependent library the watchdog needs fails to load; the system shuts down the process group.","commonSituations":"Corrupted or quarantined sidecar binary after an update or antivirus scan; running on an OS/arch lacking a matching watchdog binary; memory pressure causing OOM kills; permission errors preventing execution.","solutions":["Check preceding manager logs for why the watchdog exited (code/signal) and fix the root cause (reinstall the app to restore binaries).","Verify the watchdog executable exists, is executable, and is not blocked by antivirus — whitelist the app directory.","Confirm the platform/arch matches a shipped binary; reinstall or update the app if the sidecar is missing.","Restart the core (or the app) so startCoreProcessWatchdog spawns the watchdog again."],"exampleFix":"// before\nwatchdogProcess.once('exit', (code, signal) => {\n  managerLogger.warn(`Core process watchdog exited unexpectedly, code: ${code}, signal: ${signal}`)\n})\n// after\nwatchdogProcess.once('exit', (code, signal) => {\n  managerLogger.warn(`Core process watchdog exited unexpectedly, code: ${code}, signal: ${signal}`)\n  scheduleWatchdogRestart() // re-spawn watchdog to restore crash protection\n})","handlingStrategy":"retry","validationCode":"// Before relying on the watchdog, verify the binary is present and executable:\nimport { accessSync, constants } from 'node:fs'\ntry {\n  accessSync(watchdogPath, constants.F_OK | constants.X_OK)\n} catch {\n  console.error(`Watchdog binary missing or not executable at ${watchdogPath} — reinstall the app`)\n}","typeGuard":null,"tryCatchPattern":"watchdogProcess.once('exit', (code, signal) => {\n  if (coreProcessWatchdog?.process !== watchdogProcess) return\n  coreProcessWatchdog = null\n  managerLogger.warn(`Core process watchdog exited unexpectedly, code: ${code}, signal: ${signal}`)\n  // retry: respawn with backoff\n  setTimeout(() => startCoreProcessWatchdog().catch(err => managerLogger.error('Watchdog respawn failed', err)), 5000)\n})","preventionTips":["Reinstall/repair the app if sidecar binaries are missing or quarantined by antivirus; whitelist the install directory.","Match the app build to your OS/arch so a valid watchdog binary ships.","Watch for OOM kills in system logs and provide adequate memory.","Restart the core/app after a watchdog crash so protection is re-established."],"tags":["process","watchdog","crash"],"backgroundTag":"child-process-unexpected-exit","analyzedSha":"911e090537acdf7c50bee1c3aebecc2ef119a8b5","analyzedAt":"2026-08-30T13:00:49.174Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}