koala73/worldmonitor · error

Not found

Error message

Not found

What it means

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.

Source

Thrown at src-tauri/sidecar/local-api-server.mjs:1843

export const __testing__ = {
  isCloudPreferred,
  canCompress,
  setUpstreamIdleTimeoutMs(ms) {
    _upstreamIdleTimeoutMs = ms;
  },
};

export async function createLocalApiServer(options = {}) {
  const context = resolveConfig(options);
  loadVerboseState(context.dataDir);
  const routes = await buildRouteTable(context.apiDir);
  let unregisterSelfFetchOrigins = null;

  const server = createServer(async (req, res) => {
    const requestUrl = new URL(req.url || '/', `http://127.0.0.1:${context.port}`);

    if (!requestUrl.pathname.startsWith('/api/')) {
      res.writeHead(404, { 'content-type': 'application/json', ...makeCorsHeaders(req) });
      res.end(JSON.stringify({ error: 'Not found' }));
      return;
    }

    const start = Date.now();
    const skipRecord = req.method === 'OPTIONS'
      || requestUrl.pathname === '/api/local-traffic-log'
      || requestUrl.pathname === '/api/local-debug-toggle'
      || requestUrl.pathname === '/api/local-env-update'
      || requestUrl.pathname === '/api/local-env-update-batch'
      || requestUrl.pathname === '/api/local-validate-secret';

    try {
      const response = await dispatch(requestUrl, req, routes, context);
      const durationMs = Date.now() - start;
      let body = Buffer.from(await response.arrayBuffer());
      const headers = Object.fromEntries(response.headers.entries());
      const corsOrigin = getSidecarCorsOrigin(req);

View on GitHub (pinned to 9361220cc0)

Solutions

  1. Prefix requests with /api/ when targeting the sidecar
  2. Check for typos in the route path against the built route table
  3. Do not point browser asset requests at the local API port
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src-tauri/sidecar/local-api-server.mjs:1835 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of koala73/worldmonitor@9361220cc0 (2026-08-21). Data as JSON: /api/errors/fa21dbbcd2f73bd9. Report an issue: GitHub.