Open 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 · 19d ago
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.

0 Replies

Log in to reply.