{"record":{"id":"8f029c4715bbb2cb","repo":"googleapis/mcp-toolbox","slug":"error-parsing-json-v-8f029c","errorCode":null,"errorMessage":"error parsing JSON: %v","messagePattern":"error parsing JSON: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/util.go","lineNumber":112,"sourceCode":"\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to call tokeninfo endpoint: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tbodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error reading response body %d: %s\", resp.StatusCode, string(bodyBytes))\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"tokeninfo endpoint returned non-OK status %d: %s\", resp.StatusCode, string(bodyBytes))\n\t}\n\n\t// Unmarshal response body and get `email`\n\tvar responseJSON map[string]any\n\terr = json.Unmarshal(bodyBytes, &responseJSON)\n\tif err != nil {\n\n\t\treturn \"\", fmt.Errorf(\"error parsing JSON: %v\", err)\n\t}\n\n\temailValue, ok := responseJSON[\"email\"]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"email not found in response: %v\", err)\n\t}\n\n\tfullEmail, ok := emailValue.(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"email field is not a string\")\n\t}\n\n\tvar username string\n\t// Format the username based on Database Type\n\tswitch strings.ToLower(dbType) {\n\tcase \"mysql\":\n\t\tusername, _, _ = strings.Cut(fullEmail, \"@\")\n","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/util.go#L94-L130","documentation":"json.Unmarshal failed to decode the tokeninfo response body into a map — the endpoint returned a body that is not valid JSON, despite the 200 status.","triggerScenarios":"Thrown at internal/sources/util.go:112 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry after transient malformed responses","Log and inspect the raw body bytes","Report if the endpoint consistently returns non-JSON"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}