Explain JSON parse errors

Paste a JSON parse error, such as "Unexpected token '<'", and Vibe explains it in plain English: what text the parser was given, why it isn't JSON and what to check in the request that fetched it.

fetch-error.txt

Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.

Vibe13 lines selected

Press Explain it for the sample, or paste your own code first.

What this JSON parse error sample shows

the message
SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON means the parser was given text that starts with <, and it quotes the first 10 characters before the .... <!DOCTYPE is how an HTML page starts, so the reply was a web page, not JSON. The first 3 lines, <anonymous_script>:1, the reply's first line and a ^ under the <, point into that reply, not into a file of yours. The run ended with exit code 1.
the reply
The script asked for /api/orders. curl -i on the same address showed HTTP/1.0 404 File not found and Content-Type: text/html;charset=utf-8: the test server had /api/orders.json, not /api/orders, and answered with its HTML error page. res.json() read that page anyway. With the address changed to /api/orders.json, the script printed 3 orders, revenue 90.25.
the stack
The at lines are all inside Node.js: JSON.parse, 3 lines from node:internal/deps/undici, the code behind fetch, and one from Node's task queue. None names report.js, so the stack won't take you to the line. Look for the .json() call on a fetch reply instead; here it is line 2, const orders = await res.json();.
other parse errors
Other replies fail on the same line with other words. With an empty orders.json, the error was SyntaxError: Unexpected end of JSON input: there was nothing to parse. With a comma after the last order, it was Unexpected token ']', quoting the end of the file, 42.75 }, and the ] after it: JSON allows no comma before a closing bracket.

Good to know

  • Run with Node.js 25.7.0 on Linux, against Python 3.14.7's http.server on port 8000, serving a test folder mounted at /home/dev/shop. A real API or dev server sends its own error page, so the quoted text can differ.
  • In Chromium 156, the same fetch from a web page put Failed to load resource: the server responded with a status of 404 (File not found) in the console before the same Unexpected token '<' error. That 404 line is the reply's status, the first thing to check.

Before you trust it: A catch that falls back to an empty list hides the problem. With orders = [] in the catch, the script printed 0 orders, revenue 0.00 with exit code 0, for an address that didn't exist. Checking res.ok before res.json() stopped it with Error: GET /api/orders answered 404 File not found, which names the real problem.

Explain JSON parse errors beside your editor

Unvibe is a free app for Mac and Windows. In the app there is no pasting: select code in any app and press Control+U (Ctrl+Alt+U on Windows).

Install on Mac

curl -fsSL https://unvibe.site/install.sh | bash

Paste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.

No install warning? Use Unvibe in your browser

Opening the .dmg the first time

Unvibe isn't notarized by Apple yet, so macOS blocks the first open until you allow it. Its code is public on GitHub.

  1. Open the .dmg, drag Unvibe to Applications and open it. macOS says it can't verify it. Click Done, not the blue Move to Trash.
    macOS dialog: “Unvibe” Not Opened, with a blue Move to Trash button on top and Done under it
    Real screen, macOS 26. On macOS 15 the two buttons sit side by side.
  2. System Settings › Privacy & Security, scroll down to Security, then press Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.
    macOS Privacy & Security, Security section: Unvibe was blocked to protect your Mac, with the Open Anyway button
    Real screen, macOS 15
  3. Unvibe opens. You only do this once, and later versions install from inside the app with one click.
    Unvibe's first window: Vibe says Hey! I'm Vibe. I explain the code AI writes for you, right beside your editor, over the title Understand the code AI writes
    Real screen, Unvibe 0.1.51 on macOS 26

The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open