Start: page route returns 500 when Accept excludes HTML
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
Which project does this relate to?
Start
Describe the bug
createStartHandler refuses to render a page route when the request's Accept
header does not allow HTML, and reports that refusal as 500:
A failed content negotiation is a client-side condition, so this should be
406 Not Acceptable. 500 says the server malfunctioned, and nothing did.
Complete minimal reproducer
reproduction doesn't need any custom code
Steps to Reproduce the Bug
Against any Start app, on any page (non-server) route:
curl -i -H 'Accept: application/json' https://example.com/
curl -i -H 'Accept: image/webp' https://example.com/
Both return 500 {"error":"Only HTML requests are supported here"}. Accept: /, a browser Accept, and an absent header all return 200.
Expected behavior
Should return 406 Not Acceptable instead of 500 Server Error.
Screenshots or Videos
No response
Platform
- @tanstack/react-start 1.168.32
- @tanstack/start-server-core 1.169.17 (current latest)
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at packages/start-server-core/src/createStartHandler.ts around lines 558-561, then reproduce the issue with the provided curl commands and Accept headers. Done means non-HTML Accept values return 406 Not Acceptable, while /, browser Accept headers, and an absent header continue returning 200.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100