thedotmack/claude-mem · error · Error

Observation TV UI not found at any expected location

Error message

Observation TV UI not found at any expected location

What it means

The Observation TV handler throws when tvHtmlBytes is null, meaning tv.html was not found at either candidate path (packageRoot/ui/tv.html or packageRoot/plugin/ui/tv.html) when the routes module loaded and cached assets. Same boot-time asset resolution as the viewer UI, so every /tv request fails until the file is present.

Solutions

  1. Rebuild/reinstall so ui/tv.html exists (npm run build-and-sync)
  2. Verify tv.html exists at packageRoot/ui/tv.html or packageRoot/plugin/ui/tv.html
  3. Check startup logs to confirm which candidate path (if any) resolved
  4. Fall back to the plain /stream SSE endpoint if only the TV UI is missing and you need live output

Example fix

// before
// routes loaded with tvHtmlBytes === null; every /tv request throws
// after
// rebuild so the asset ships:
//   npm run build-and-sync
//   test -f <packageRoot>/ui/tv.html && echo ok
Defensive patterns

Strategy: fallback

Validate before calling

import { existsSync } from 'fs';
import path from 'path';
const packageRoot = getPackageRoot();
const tvHtmlExists =
  existsSync(path.join(packageRoot, 'ui', 'tv.html')) ||
  existsSync(path.join(packageRoot, 'plugin', 'ui', 'tv.html'));

Try / catch

app.get('/tv', (req, res) => {
  try {
    return tvHandler(req, res);
  } catch (err) {
    if (err instanceof Error && err.message.includes('Observation TV UI not found')) {
      return res.status(503).send('TV UI asset missing — use /stream directly or rebuild the package.');
    }
    throw err;
  }
});

Prevention

When it happens

Trigger: GET to the Observation TV endpoint when tv.html was missing at startup — asset not built, not copied into plugin/ui/, or getPackageRoot() resolved to the wrong directory.

Common situations: Fresh install where the build step that generates/copies tv.html was skipped; deployment artifact missing the tv asset; running a dev build from a directory where only viewer.html exists; package layout change after an upgrade.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/671067562d0cb236. Report an issue: GitHub.

Appendix: source

Thrown at src/services/worker/http/routes/ViewerRoutes.ts:196

    });
  });

  private handleViewerUI = this.wrapHandler((req: Request, res: Response): void => {
    if (!viewerHtmlBytes) {
      throw new Error('Viewer UI not found at any expected location');
    }
    res.setHeader('Content-Type', 'text/html; charset=utf-8');
    res.send(viewerHtmlBytes);
  });

  /**
   * Observation TV: the same /stream the viewer consumes, rendered as a
   * full-screen fading title card. Static, dependency-free, and served from
   * the same origin so the EventSource needs no CORS of its own.
   */
  private handleTvUI = this.wrapHandler((req: Request, res: Response): void => {
    if (!tvHtmlBytes) {
      throw new Error('Observation TV UI not found at any expected location');
    }
    res.setHeader('Content-Type', 'text/html; charset=utf-8');
    res.send(tvHtmlBytes);
  });

  /**
   * The target of the restart link in the observer-outage warning
   * (renderObserverHealthWarning). Serves an INERT page: the restart itself is
   * the POST /api/admin/restart behind the button, never this GET.
   *
   * A GET that restarted the worker would fire from any page that could name
   * the URL — `<img src="http://localhost:PORT/restart">` on a site the user
   * happens to open is enough. Same reason the page does not POST on load: an
   * <iframe> would run that script.
   *
   * Requiring a click is NOT on its own enough, though: an attacker who frames
   * this page can still collect a real click through an overlay. So the route
   * also refuses to be framed at all — frame-ancestors 'none' for modern

View on GitHub (pinned to d8bc9755e7)