{"record":{"id":"671067562d0cb236","repo":"thedotmack/claude-mem","slug":"observation-tv-ui-not-found-at-any-expected-locati","errorCode":null,"errorMessage":"Observation TV UI not found at any expected location","messagePattern":"Observation TV UI not found at any expected location","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/services/worker/http/routes/ViewerRoutes.ts","lineNumber":196,"sourceCode":"    });\n  });\n\n  private handleViewerUI = this.wrapHandler((req: Request, res: Response): void => {\n    if (!viewerHtmlBytes) {\n      throw new Error('Viewer UI not found at any expected location');\n    }\n    res.setHeader('Content-Type', 'text/html; charset=utf-8');\n    res.send(viewerHtmlBytes);\n  });\n\n  /**\n   * Observation TV: the same /stream the viewer consumes, rendered as a\n   * full-screen fading title card. Static, dependency-free, and served from\n   * the same origin so the EventSource needs no CORS of its own.\n   */\n  private handleTvUI = this.wrapHandler((req: Request, res: Response): void => {\n    if (!tvHtmlBytes) {\n      throw new Error('Observation TV UI not found at any expected location');\n    }\n    res.setHeader('Content-Type', 'text/html; charset=utf-8');\n    res.send(tvHtmlBytes);\n  });\n\n  /**\n   * The target of the restart link in the observer-outage warning\n   * (renderObserverHealthWarning). Serves an INERT page: the restart itself is\n   * the POST /api/admin/restart behind the button, never this GET.\n   *\n   * A GET that restarted the worker would fire from any page that could name\n   * the URL — `<img src=\"http://localhost:PORT/restart\">` on a site the user\n   * happens to open is enough. Same reason the page does not POST on load: an\n   * <iframe> would run that script.\n   *\n   * Requiring a click is NOT on its own enough, though: an attacker who frames\n   * this page can still collect a real click through an overlay. So the route\n   * also refuses to be framed at all — frame-ancestors 'none' for modern","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/services/worker/http/routes/ViewerRoutes.ts#L178-L214","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Rebuild/reinstall so ui/tv.html exists (npm run build-and-sync)","Verify tv.html exists at packageRoot/ui/tv.html or packageRoot/plugin/ui/tv.html","Check startup logs to confirm which candidate path (if any) resolved","Fall back to the plain /stream SSE endpoint if only the TV UI is missing and you need live output"],"exampleFix":"// before\n// routes loaded with tvHtmlBytes === null; every /tv request throws\n// after\n// rebuild so the asset ships:\n//   npm run build-and-sync\n//   test -f <packageRoot>/ui/tv.html && echo ok","handlingStrategy":"fallback","validationCode":"import { existsSync } from 'fs';\nimport path from 'path';\nconst packageRoot = getPackageRoot();\nconst tvHtmlExists =\n  existsSync(path.join(packageRoot, 'ui', 'tv.html')) ||\n  existsSync(path.join(packageRoot, 'plugin', 'ui', 'tv.html'));","typeGuard":null,"tryCatchPattern":"app.get('/tv', (req, res) => {\n  try {\n    return tvHandler(req, res);\n  } catch (err) {\n    if (err instanceof Error && err.message.includes('Observation TV UI not found')) {\n      return res.status(503).send('TV UI asset missing — use /stream directly or rebuild the package.');\n    }\n    throw err;\n  }\n});","preventionTips":["Run the build/sync pipeline that emits ui/tv.html before deploying","Smoke-test GET /tv at deploy time so a missing asset is caught immediately","Verify the package root resolution in your runtime environment","Include the ui/ assets in your artifact verification checklist"],"tags":["http","static-assets","deployment"],"backgroundTag":"file-not-found","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}