{"record":{"id":"fa95a377ddf8deb8","repo":"vercel/ai","slug":"failed-to-load-google-credentials-error-message","errorCode":null,"errorMessage":"Failed to load Google credentials: ${error.message}","messagePattern":"Failed to load Google credentials: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/google-vertex/src/edge/google-vertex-auth-edge.ts","lineNumber":50,"sourceCode":"      clientEmail: loadSetting({\n        settingValue: undefined,\n        settingName: 'clientEmail',\n        environmentVariableName: 'GOOGLE_CLIENT_EMAIL',\n        description: 'Google client email',\n      }),\n      privateKey: loadSetting({\n        settingValue: undefined,\n        settingName: 'privateKey',\n        environmentVariableName: 'GOOGLE_PRIVATE_KEY',\n        description: 'Google private key',\n      }),\n      privateKeyId: loadOptionalSetting({\n        settingValue: undefined,\n        environmentVariableName: 'GOOGLE_PRIVATE_KEY_ID',\n      }),\n    };\n  } catch (error: any) {\n    throw new Error(`Failed to load Google credentials: ${error.message}`);\n  }\n};\n\n// Convert a string to base64url\nconst base64url = (str: string) => {\n  return btoa(str).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n};\nconst importPrivateKey = async (pemKey: string) => {\n  const pemHeader = '-----BEGIN PRIVATE KEY-----';\n  const pemFooter = '-----END PRIVATE KEY-----';\n\n  // Remove header, footer, and any whitespace/newlines\n  const pemContents = pemKey\n    .replace(pemHeader, '')\n    .replace(pemFooter, '')\n    .replace(/\\s/g, '');\n\n  // Decode base64 to binary","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/google-vertex/src/edge/google-vertex-auth-edge.ts#L32-L68","documentation":"Error \"Failed to load Google credentials: ${error.message}\" thrown in vercel/ai.","triggerScenarios":"Thrown at packages/google-vertex/src/edge/google-vertex-auth-edge.ts:50 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":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}