question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🐛 Bug]: JSON parsing error when creating capabilities

See original GitHub issue

What happened?

When starting a session on Sauce Labs, if a user does not have sufficient VMs for their account, Sauce Labs will reply with a redirect message and (I believe) an empty payload. @shs96c I know you fixed something like this and I thought it was addressed in the RC, but the stack trace below is showing 4.0.0. Does a Redirect response need separate processing? It seems like it shouldn’t be necessary to parse the payload at all for a redirect.

How can we reproduce the issue?

It would be difficult to reproduce this without a Sauce account and running more in parallel than sessions available, but should be able to mock out a response in a unit test?

Relevant log output

Caused by: org.openqa.selenium.json.JsonException: Unable to parse: 
	at org.openqa.selenium.json.Json.toType(Json.java:57)
	at org.openqa.selenium.json.Json.toType(Json.java:50)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:109)
	... 28 more
Caused by: org.openqa.selenium.json.JsonException: Expected to read a START_MAP but instead have: END. Last 0 characters read: 
Build info: version: '4.0.0', revision: '3a21814679'
System info: host: 'EC2AMAZ-DQI8KAO', ip: '10.204.197.75', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '15.0.2'
Driver info: driver.version: RemoteWebDriver
	at org.openqa.selenium.json.JsonInput.expect(JsonInput.java:307)
	at org.openqa.selenium.json.JsonInput.beginObject(JsonInput.java:229)
	at org.openqa.selenium.json.MapCoercer.lambda$apply$1(MapCoercer.java:64)
	at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:145)
	at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:127)
	at org.openqa.selenium.json.Json.toType(Json.java:71)
	at org.openqa.selenium.json.Json.toType(Json.java:55)
	... 30 more

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Unable to parse remote response: 
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:112)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)

Operating System

n/a

Selenium version

4.0.0

What are the browser(s) and version(s) where you see this issue?

n/a

What are the browser driver(s) and version(s) where you see this issue?

n/a

Are you using Selenium Grid?

n/a

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
mykola-mokhnachcommented, Dec 8, 2021

Linking https://github.com/appium/java-client/issues/1608

Basically, what needs to be done is to enable followRedirects option for the default HTTP client.

0reactions
github-actions[bot]commented, Jan 8, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON parsing error thrown during System Startup | Confluence
RuntimeException: Failed to parse AuditLogEntry from JSON string: {"username":"Confluence","date":1322652622518,"i18nKey":"upm.
Read more >
JSON parse error on Firebase functions · Issue #2331 - GitHub
I'm trying to host Apollo on Firebase functions and it's mostly working, but the playground is getting a JSON parsing error.
Read more >
SyntaxError: JSON.parse: bad parsing - LambdaTest
SyntaxError is an inherited object of the main error object The main reason behind the error is usually a mistake in the JSON...
Read more >
JSON Parse Error - Alteryx Community
I have an API call set up which appears to be extracting data through the Download, however when I try and JSON Parse...
Read more >
SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found