{"record":{"id":"7084b2586db09193","repo":"googleapis/mcp-toolbox","slug":"email-field-is-not-a-string","errorCode":null,"errorMessage":"email field is not a string","messagePattern":"email field is not a string","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/util.go","lineNumber":122,"sourceCode":"\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\n\tcase \"postgres\":\n\t\t// service account email used for IAM should trim the suffix\n\t\tusername = strings.TrimSuffix(fullEmail, \".gserviceaccount.com\")\n\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"unsupported dbType: %s. Use 'mysql' or 'postgres'\", dbType)\n\t}\n\n\tif username == \"\" {\n\t\treturn \"\", fmt.Errorf(\"username from ADC cannot be an empty string\")","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/util.go#L104-L140","documentation":"The `email` field in the tokeninfo response was present but not a JSON string (the type assertion to string failed) — an unexpected tokeninfo payload shape.","triggerScenarios":"Thrown at internal/sources/util.go:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the actual JSON type of the email field","Retry after anomalous endpoint responses","Report upstream if the payload format changed"],"exampleFix":null,"handlingStrategy":"type-guard","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"}