Each entry below is a verbatim error string developers search for. Click any error to see the exact cause, a code example, and a working fix. Working with a JSON API response right now? Use the JSON Formatter or JSON Validator to inspect it.
Error reference
| Error | Language / Context | Category |
|---|---|---|
| TypeError: Failed to fetch | JavaScript / Browser | Network |
| CORS policy: No ‘Access-Control-Allow-Origin’ header is present | JavaScript / Browser | Network |
| Unexpected token < in JSON at position 0 | JavaScript | JSON |
| Unexpected end of JSON input | JavaScript | JSON |
| Unexpected token o in JSON at position 1 | JavaScript | JSON |
| JSON SyntaxError: Missing Comma | JSON | JSON |
| JSON SyntaxError: Trailing Comma | JSON | JSON |
| JSON SyntaxError: Single Quotes Not Allowed | JSON | JSON |
| JSON SyntaxError: Comments Not Allowed | JSON | JSON |
| JSON SyntaxError: NaN / Infinity Not Allowed | JSON | JSON |
| TypeError: Converting circular structure to JSON | JavaScript | JSON |
| JSON.parse returns string, not object | JavaScript | JSON |
| SyntaxError in JSON.parse — error handling patterns | JavaScript | JSON |
No errors match your filter.
Error categories
- Network errors — the request never reached the server: CORS blocks, connection refused, mixed content, offline. These throw
TypeError: Failed to fetch(or browser-equivalent) and reject the fetch promise. - JSON errors —
SyntaxErrorthrown byJSON.parse()orresponse.json()when the response body is not valid JSON. The most common cause is the server returning HTML (a 404 or 500 error page) instead of JSON. - Node.js errors — runtime errors specific to the Node.js environment: missing modules, port conflicts, process signals. Coming soon.
- Python errors — errors from Python's
jsonmodule and therequestslibrary:JSONDecodeError,HTTPError, and related. Coming soon.
Frequently Asked Questions
What does TypeError: Failed to fetch mean?
TypeError: Failed to fetch means the browser could not complete the HTTP request at the network level — before the server ever responded. The most common causes are a CORS block, the server being unreachable (ERR_CONNECTION_REFUSED), a mixed-content policy violation (HTTP from an HTTPS page), or no internet connection. See the full reference for all causes and fixes.
What is a CORS error?
A CORS (Cross-Origin Resource Sharing) error happens when a browser script tries to fetch a resource from a different origin and the server does not include the Access-Control-Allow-Origin header in its response. The browser blocks the response as a security measure. The fix is always on the server: add CORS headers to your API responses. See the CORS error reference for framework-specific fixes.
Why does JSON.parse throw a SyntaxError?
JSON.parse throws SyntaxError when the string is not valid JSON. Common causes include: the server returned HTML instead of JSON (giving Unexpected token <), a trailing comma or single quotes in the JSON, an unterminated string, or the response was empty (giving Unexpected end of JSON input). Check what the server actually returned with response.text() before calling .json().
What is the difference between a network error and an HTTP error?
A network error (like TypeError: Failed to fetch) means the request never reached the server — the connection failed at the network level. An HTTP error (like 404 or 500) means the server received the request and responded with an error status code. In JavaScript, fetch() only rejects on network errors; HTTP errors come back as resolved responses with a non-OK status that you must check with response.ok or response.status. See the HTTP Status Codes reference for all codes.
Last updated: June 2026