anomalyco / anomalyco/opencode
SDK text/html guard misses responses with a charset parameter
Open
@kitlangton is already working on this.
Since Aug 7, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
packages/sdk/js/src/v2/client.ts:86 checks the content-type with strict equality:
client.interceptors.response.use((response) => {
const contentType = response.headers.get("content-type")
if (contentType === "text/html")
throw new Error("Request is not supported by this version of OpenCode Server (Server responded with text/html)")
return response
})
Servers normally send text/html; charset=utf-8, so the comparison fails and the guard never fires. The caller then gets a JSON parse error instead of the message explaining that the server version doesn't support the request.
contentType?.startsWith("text/html") fixes it. Happy to send a PR.
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.
Assessment
This issue has not been assessed yet.