Skip to content

opencode web: many API routes return SPA HTML instead of JSON, causing ClientError: UnsupportedContentType #39017

Description

@Winsoftpedia

Description

When running opencode web and accessing the interface via a browser (e.g. http://localhost:18000), several API endpoints return text/html (the SPA shell) instead of application/json. This causes the frontend to throw ClientError: UnsupportedContentType in the C$ function (content-type check in the fetch wrapper), logged as "Failed to finish bootstrap instance".

Impact

  • Console error on every page load: Failed to finish bootstrap instance ClientError: UnsupportedContentType
  • Toast notification: "Failed to reload {project}"
  • The UI still works despite the error (the bootstrap runner catches it gracefully)
  • Desktop app and CLI are not affected — only opencode web

Affected endpoints

The following endpoints return text/html (SPA fallback) instead of the expected application/json or text/event-stream:

Endpoint Expected Actual
GET /api/server JSON HTML
GET /api/path?location=... JSON HTML
GET /api/vcs?location=... JSON HTML
GET /api/model/default?location=... JSON HTML
GET /api/plugin JSON HTML
GET /api/permission/request/list?location=... JSON HTML
GET /api/question/request/list?location=... JSON HTML
POST /api/session/{id}/command JSON HTML

Meanwhile, these endpoints work correctly:

  • GET /api/health
  • GET /api/session
  • GET /api/agent
  • GET /api/location
  • GET /api/session/active
  • GET /global/config
  • GET /global/health
  • All /experimental/... endpoints ✅

Notes

  • The experimental API endpoints (/experimental/...) work correctly on the same server
  • Running with --pure (no plugins) does not fix it
  • Clean reinstall of v1.18.5 does not fix it
  • Version: 1.18.5 (latest)
  • Root cause: the C$ function in the frontend bundle checks Content-Type and throws for non-JSON/non-SSE responses

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions