{"record":{"id":"fa21dbbcd2f73bd9","repo":"koala73/worldmonitor","slug":"not-found-fa21db","errorCode":null,"errorMessage":"Not found","messagePattern":"Not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"src-tauri/sidecar/local-api-server.mjs","lineNumber":1843,"sourceCode":"export const __testing__ = {\n  isCloudPreferred,\n  canCompress,\n  setUpstreamIdleTimeoutMs(ms) {\n    _upstreamIdleTimeoutMs = ms;\n  },\n};\n\nexport async function createLocalApiServer(options = {}) {\n  const context = resolveConfig(options);\n  loadVerboseState(context.dataDir);\n  const routes = await buildRouteTable(context.apiDir);\n  let unregisterSelfFetchOrigins = null;\n\n  const server = createServer(async (req, res) => {\n    const requestUrl = new URL(req.url || '/', `http://127.0.0.1:${context.port}`);\n\n    if (!requestUrl.pathname.startsWith('/api/')) {\n      res.writeHead(404, { 'content-type': 'application/json', ...makeCorsHeaders(req) });\n      res.end(JSON.stringify({ error: 'Not found' }));\n      return;\n    }\n\n    const start = Date.now();\n    const skipRecord = req.method === 'OPTIONS'\n      || requestUrl.pathname === '/api/local-traffic-log'\n      || requestUrl.pathname === '/api/local-debug-toggle'\n      || requestUrl.pathname === '/api/local-env-update'\n      || requestUrl.pathname === '/api/local-env-update-batch'\n      || requestUrl.pathname === '/api/local-validate-secret';\n\n    try {\n      const response = await dispatch(requestUrl, req, routes, context);\n      const durationMs = Date.now() - start;\n      let body = Buffer.from(await response.arrayBuffer());\n      const headers = Object.fromEntries(response.headers.entries());\n      const corsOrigin = getSidecarCorsOrigin(req);","sourceCodeStart":1825,"sourceCodeEnd":1861,"githubUrl":"https://github.com/koala73/worldmonitor/blob/9361220cc013571781071f0206e4d80fd14b2f7f/src-tauri/sidecar/local-api-server.mjs#L1825-L1861","documentation":"Plain 404 response written by the sidecar local API server when a request path does not start with /api/. The Node.js server only serves API routes; any non-API path (or unknown route after table lookup misses) gets this JSON Not found with CORS headers.","triggerScenarios":"Thrown at src-tauri/sidecar/local-api-server.mjs:1835 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Prefix requests with /api/ when targeting the sidecar","Check for typos in the route path against the built route table","Do not point browser asset requests at the local API port"],"exampleFix":null,"handlingStrategy":"validation","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"}