Unexpected token in JSON
See original GitHub issueCurrent behavior
Occasionally hitting this issue when running on MacOS 12, Node v14.20.0 and Chrome 103 / Firefox 103.
================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 10.3.1 │
│ Browser: Custom Chrome 103 │
│ Node Version: v14.20.0 (/Users/chef/payload/bundle/bundle/node) │
│ Specs: 20 found (todo.cy.js, actions.cy.js, aliasing.cy.js, assertions.cy.js, connect │
│ ors.cy.js, cookies.cy.js, cypress_api.cy.js, files.cy.js, local_storage.cy.js, │
│ location.cy.js, misc.cy.js, navigation.cy.js, network_requests.cy.js, queryin │
│ g.cy.js, spies_stubs_cl...) │
│ Searched: **/*cy.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: todo.cy.js (1 of 20)
Unexpected token < in JSON at position 0
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>:null:null)
at /Users/chef/payload/bundle/bundle/Cache/10.3.1/Cypress.app/Contents/Resources/app/node_modules/chrome-remote-interface/lib/devtools.js:121:33
at IncomingMessage.<anonymous> (/Users/chef/payload/bundle/bundle/Cache/10.3.1/Cypress.app/Contents/Resources/app/node_modules/chrome-remote-interface/lib/external-request.js:32:17)
at IncomingMessage.emit (node:events:402:35)
at IncomingMessage.emit (node:domain:475:12)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Desired behavior
Error should not occur.
Test code to reproduce
Cypress kitchensink example.
Cypress Version
10.3.1
Other
No response
Issue Analytics
- State:
- Created a year ago
- Comments:14 (3 by maintainers)
Top Results From Across the Web
What Is JSON and How to Handle an “Unexpected Token” Error
“Unexpected token < in JSON at position 0” is the error that I have seen most throughout my time of working as a...
Read more >How to Fix SyntaxError: Unexpected token < in JSON at ...
Usually this error is caused when your server returns HTML (which typically begins with <DOCTYPE html> or <html> ) instead of JSON. Valid...
Read more >Error "Uncaught SyntaxError: Unexpected token with JSON ...
The error you are getting, i.e., "unexpected token o", is because JSON is expected, but an ...
Read more >How to Fix 'Unexpected token o in JSON at position 1' - Webtips
The error happens when JSON.parse gets an invalid JSON string. The reason this error message happens is that you try to pass an...
Read more >Unexpected token u in JSON at position 0 Error in JS
The "Unexpected token u in JSON at position 0" error occurs when we pass an undefined value to the JSON.parse or $.parseJSON methods....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @alexplischke,
There are few different logs that might provide useful information. Unfortunately, I can’t reproduce this. I would greatly appreciate it if you had the time to try to grab the logs in the failure scenario.
DEBUG=cypress:server:browsers:cri-client*,cypress-verbose:server:browsers:cri-client*,cypress:server:browsers:browser-cri-client npx cypress run
Reopening so we can use this ticket to track the status of updating the get-port library once we have a minimum node version that allows us to require node >12.20. Going to route this ticket to the E2E team for prioritization in their backlog.