{"record":{"id":"84eba837332086f6","repo":"nodejs/node","slug":"unexpected-json-output-s","errorCode":null,"errorMessage":"Unexpected json output: %s","messagePattern":"Unexpected json output: (.+?)","errorType":"http","errorClass":"HttpError","httpStatus":200,"severity":"error","filePath":"deps/v8/tools/release/roll_bisect.py","lineNumber":85,"sourceCode":"  response, contents = conn.request(uri=uri, **params)\n  contents = contents.decode(\"utf-8\", \"replace\")\n  return StringIO(contents)\n\n\ndef HttpJSONQuery(*args, **params):\n  headers = params.setdefault(\"headers\", {})\n  headers.setdefault(\"Accept\", \"application/json\")\n\n  if \"body\" in params:\n    assert (params.get(\"method\", \"GET\") != \"GET\")\n    if not isinstance(params[\"body\"], str):\n      params[\"body\"] = json.dumps(params[\"body\"])\n      headers.setdefault(\"Content-Type\", \"application/json\")\n\n  fh = HttpQuery(*args, **params)\n  s = fh.readline()\n  if s and s.rstrip() != \")]}'\":\n    raise HttpError(200, \"Unexpected json output: %s\" % s)\n  s = fh.read()\n  if not s:\n    return None\n  return json.loads(s)\n\n\ndef QueryTryBotsForFailures(change, patchset, timeout=300):\n  builds = HttpJSONQuery(\n      \"https://cr-buildbucket.appspot.com/prpc/buildbucket.v2.Builds/SearchBuilds\",\n      method=\"POST\",\n      body={\n          \"fields\":\n              \"builds.*.builder,builds.*.id,builds.*.status,builds.*.startTime,builds.*.endTime\",\n          \"predicate\": {\n              \"tags\": [{\n                  \"key\": \"cq_experimental\",\n                  \"value\": \"false\"\n              }],","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/v8/tools/release/roll_bisect.py#L67-L103","documentation":"HttpJSONQuery expects Google pRPC-style endpoints, which prefix their JSON body with the XSSI-protection line `)]}'`. If the first line read is anything else, the server returned non-JSON (HTML error/login page, redirect, proxy interstitial) and the call is failed as HttpError 200 with the offending first line in the message.","triggerScenarios":"Querying a buildbucket/monorail-style pRPC endpoint whose response does not begin with the `)]}'` prefix.","commonSituations":"Endpoint moved/deprecated; auth cookie expired so the server returns an HTML login page; corporate proxy returns an interstitial; wrong host/URL.","solutions":["Confirm the URL is the correct pRPC endpoint.","Re-authenticate / refresh credentials (gcert, luci-auth).","Inspect the actual response body (the %s in the message tells you what came back).","Rule out proxy/interstitial interference."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    data = HttpJSONQuery(url, method='POST', body=body)\nexcept HttpError as e:\n    if e.status == 200 and 'Unexpected json output' in str(e):\n        # likely an auth/login page or proxy interstitial\n        log.error('endpoint did not return JSON; re-auth or check URL: %s', e)\n    raise","preventionTips":["Refresh credentials (gcert / luci-auth) before long-running bisect scripts.","Pin to known pRPC endpoint URLs.","Beware corporate proxies that inject interstitials."],"tags":["http","prpc","release-tools","v8","auth","network"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}