Closed general

In-app repo/profile viewer renders 'trash page' for missing pages — raw HTML README + 'Unexpected token <' JSON errors (is a repo manager built yet?)

Drew Owens · 1mo ago ·closed by John Lauer
hd-feedback

Type: Bug · [hd-feedback]

Clicking a repo/page name (e.g. drew2 / Hydrogen Desktop) — or clicking your own profile name (drew2) — lands on a broken "trash page": the README panel renders the raw SvelteKit HTML app-shell, and every side panel throws a JSON parse error. There is no not-found / empty state, so a missing page renders as garbage instead of a clean "page doesn't exist" screen.

Symptoms (see screenshot)

  • README panel shows raw HTML source (<link rel="modulepreload" …>, <body data-hd-main="true">, the __sveltekit_… bootstrap) instead of rendered markdown.
  • History, Workcell Layouts, and Electronic Schematics panels each show: Error loading … : Unexpected token '<', "<!DOCTYPE "... is not valid JSON
  • Latest Project Files: "No files found".
  • Same broken page when clicking the profile name drew2.

Root cause (confirmed against wiki.adom.inc)

The panels fetch a route that 404s to the SPA fallback HTML, then call res.json() / JSON.parse() on <!DOCTYPE html>…:

$ curl -s -o /dev/null -w "HTTP %{http_code} | ctype=%{content_type}\n" \
    https://wiki.adom.inc/drew2/hydrogen-desktop
HTTP 404 | ctype=text/html; charset=utf-8      # <-- HTML, not JSON

$ curl -s https://wiki.adom.inc/api/pages/drew2/hydrogen-desktop
{"error":"Page not found", ...}                 # <-- the page genuinely doesn't exist

So two things compound:

  1. The page drew2/hydrogen-desktop was never created — the API returns a clean JSON 404. The fork/link points at a namespace slug that has no backing page repo. (adom-wiki repo log|status|page stats drew2/hydrogen-desktop all → 404 "Page not found".)
  2. The HD repo/profile viewer has no error handling for that 404. It renders the HTML fallback as README content and pipes the same HTML into JSON.parse in the History / Workcell Layouts / Electronic Schematics panels.

Repro

  1. In HD, open a fork/profile that resolves to a non-existent page slug (here: drew2/hydrogen-desktop, reached by clicking the repo name after forking, or by clicking the drew2 profile name).
  2. Observe README shows raw HTML and all three side panels show the Unexpected token '<' JSON error.

Open question for John

Is there a real repo manager built out for HD yet, or is this viewer a stub? From the live behavior it looks unfinished: no not-found/empty state, no content-type guard before JSON.parse, and the fork flow produced a dead link (drew2/hydrogen-desktop doesn't exist). If a repo manager is planned, this page is the natural home for it.

Suggested fixes

  • Guard every panel fetch: check res.ok and content_type: application/json before parsing; on non-JSON / 404, render a clean "page not found / no repo here" empty state instead of dumping HTML.
  • Don't render README from an HTML fallback — if the README fetch isn't markdown, show the empty state.
  • Fix the fork/profile links so they only point at pages that actually exist (or create the page on fork so the slug resolves).

Environment

item value
HD v0.1.95 · release · Jun 29 5:57 PM · signed · AD 1.9.62
Registry https://wiki.adom.inc
User drew2 ([email protected])
Failing route /drew2/hydrogen-desktop → HTTP 404, text/html

Filed by hand via adom-wiki discussion ([email protected]). Screenshot available; happy to test a fix.

2 Replies

John Lauer · 10d ago

TRIAGE (Fable 5, 2026-07-31): partly addressed. The [owner]/+page.svelte now has explicit missing-owner/missing-type handling ('Handle case where data or data.owner is missing'), so the crash surface has had work. But I could not fully confirm the specific 'raw HTML README + Unexpected token < JSON parse' failure is gone without hitting a genuinely-missing page live. Needs a live check against a known-missing repo/profile page on 0.1.303 before closing.

John Lauer · 7d ago

Closing as fixed across two rounds of work, verified in source:

  1. The repo/molecule viewer panels now guard every fetch (response.ok + content-type checks before parsing in the blob/tree pages), so a 404-to-SPA-fallback renders an empty/error state instead of raw HTML or an "Unexpected token <" JSON crash. The owner page also gained explicit missing-owner handling (July).
  2. As of 2026-08-03 the profile menu's repo/profile entries no longer route into the in-app viewer at all: they open the user's real wiki pages (wiki.adom.inc) in an HD browser window. The in-app viewer route that produced the trash page is no longer on the menu path that triggered this report (it also, amusingly, turned out to blank the main window when invoked as a UI action, found and fixed in today's menu ralph-test).

On the open question: no dedicated repo manager is planned inside HD; the wiki IS the repo surface, and HD now links to it rather than re-implementing it. If a raw-HTML render ever reappears on some remaining in-app path, file it fresh with the failing route.

Log in to reply.