{"record":{"id":"ae37233f271f7f2c","repo":"koala73/worldmonitor","slug":"internal-server-error","errorCode":null,"errorMessage":"Internal server error","messagePattern":"Internal server error","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"src-tauri/sidecar/local-api-server.mjs","lineNumber":1899,"sourceCode":"\n      res.writeHead(response.status, headers);\n      res.end(body);\n    } catch (error) {\n      const durationMs = Date.now() - start;\n      context.logger.error('[local-api] fatal', error);\n\n      if (!skipRecord) {\n        recordTraffic({\n          timestamp: new Date().toISOString(),\n          method: req.method,\n          path: requestUrl.pathname + (requestUrl.search || ''),\n          status: 500,\n          durationMs,\n          error: error.message,\n        });\n      }\n\n      res.writeHead(500, { 'content-type': 'application/json', ...makeCorsHeaders(req) });\n      res.end(JSON.stringify({ error: 'Internal server error' }));\n    }\n  });\n\n  return {\n    context,\n    routes,\n    server,\n    async start() {\n      const tryListen = (port) => new Promise((resolve, reject) => {\n        const onListening = () => { server.off('error', onError); resolve(); };\n        const onError = (error) => { server.off('listening', onListening); reject(error); };\n        server.once('listening', onListening);\n        server.once('error', onError);\n        server.listen(port, '127.0.0.1');\n      });\n\n      try {","sourceCodeStart":1881,"sourceCodeEnd":1917,"githubUrl":"https://github.com/koala73/worldmonitor/blob/9361220cc013571781071f0206e4d80fd14b2f7f/src-tauri/sidecar/local-api-server.mjs#L1881-L1917","documentation":"Generic 500 JSON response emitted by the sidecar's top-level request handler catch block when any handler throws unexpectedly. The real error is logged as '[local-api] fatal' and recorded in the traffic log with its message; the wire body deliberately reveals only 'Internal server error' plus CORS headers.","triggerScenarios":"Thrown at src-tauri/sidecar/local-api-server.mjs:1891 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the sidecar log for the '[local-api] fatal' entry to identify the underlying exception","Check the traffic record's error field for the captured message","Fix the route handler that threw; the 500 itself is only a symptom"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9361220cc013571781071f0206e4d80fd14b2f7f","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}