{"record":{"id":"25dabf132066ecd2","repo":"googleapis/mcp-toolbox","slug":"error-getting-email-from-adc-v-25dabf","errorCode":null,"errorMessage":"error getting email from ADC: %v","messagePattern":"error getting email from ADC: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/cloudsqlmysql/cloud_sql_mysql.go","lineNumber":205,"sourceCode":"\nfunc getConnectionConfig(ctx context.Context, user, pass string) (string, string, bool, error) {\n\tuseIAM := true\n\n\t// If username and password both provided, use password authentication\n\tif user != \"\" && pass != \"\" {\n\t\tuseIAM = false\n\t\treturn user, pass, useIAM, nil\n\t}\n\n\t// If username is empty, fetch email from ADC\n\t// otherwise, use username as IAM email\n\tif user == \"\" {\n\t\tif pass != \"\" {\n\t\t\treturn \"\", \"\", useIAM, fmt.Errorf(\"password is provided without a username. Please provide both a username and password, or leave both fields empty\")\n\t\t}\n\t\temail, err := sources.GetIAMPrincipalEmailFromADC(ctx, \"mysql\")\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", useIAM, fmt.Errorf(\"error getting email from ADC: %v\", err)\n\t\t}\n\t\tuser = email\n\t}\n\n\t// Pass the user, empty password and useIAM set to true\n\treturn user, pass, useIAM, nil\n}\n\nfunc buildDSN(user, pass, driverName, project, region, instance, dbname, userAgent string, useIAM, readOnly bool) string {\n\tconnAttrs := fmt.Sprintf(\"program_name:%s\", url.QueryEscape(userAgent))\n\tif readOnly {\n\t\tconnAttrs += \",read_only_connection:true\"\n\t}\n\n\tif useIAM {\n\t\treturn fmt.Sprintf(\"%s@%s(%s:%s:%s)/%s?connectionAttributes=%s\",\n\t\t\tuser,\n\t\t\tdriverName,","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/cloudsqlmysql/cloud_sql_mysql.go#L187-L223","documentation":"Error \"error getting email from ADC: %v\" thrown in googleapis/mcp-toolbox.","triggerScenarios":"Thrown at internal/sources/cloudsqlmysql/cloud_sql_mysql.go:205 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"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"}