Problem
When the app has no processed papers yet (outputs/index.json doesn't exist), the UI displays:
Failed to load papers
Unexpected token '<', "<!doctype "... is not valid JSON
Root cause
frontend/src/api/papers.ts:5 calls fetch('/outputs/index.json'). The Vite middleware in frontend/vite.config.ts only serves the file if it exists — otherwise it falls through and Vite serves index.html, which the frontend then tries to parse as JSON.
Expected behavior
Empty state should show a friendly "No papers yet — process one to get started" message (matching the existing empty-state UX in the CLI list command).
Suggested fix
- In
fetchIndex(), treat a 404 (or non-JSON response) as an empty index rather than throwing.
- Or: have the Vite middleware return
{"papers": []} with Content-Type: application/json when index.json doesn't exist.
- Or: have the backend's
/api/papers endpoint return an empty list, and switch the frontend to use it instead of reading outputs/index.json directly.
Repro
- Clone repo, install deps
- Start frontend + backend without processing any papers first
- Open UI — error appears
Problem
When the app has no processed papers yet (
outputs/index.jsondoesn't exist), the UI displays:Root cause
frontend/src/api/papers.ts:5callsfetch('/outputs/index.json'). The Vite middleware infrontend/vite.config.tsonly serves the file if it exists — otherwise it falls through and Vite servesindex.html, which the frontend then tries to parse as JSON.Expected behavior
Empty state should show a friendly "No papers yet — process one to get started" message (matching the existing empty-state UX in the CLI
listcommand).Suggested fix
fetchIndex(), treat a 404 (or non-JSON response) as an empty index rather than throwing.{"papers": []}withContent-Type: application/jsonwhenindex.jsondoesn't exist./api/papersendpoint return an empty list, and switch the frontend to use it instead of readingoutputs/index.jsondirectly.Repro