| 701 | // google-auth-library throws plain Error (no typed name like AWS's |
| 702 | // CredentialsProviderError). Match common SDK-level credential-failure messages. |
| 703 | function isGoogleAuthLibraryCredentialError(error: unknown): boolean { |
| 704 | if (!(error instanceof Error)) return false |
| 705 | const msg = error.message |
| 706 | return ( |
| 707 | msg.includes('Could not load the default credentials') || |
| 708 | msg.includes('Could not refresh access token') || |
| 709 | msg.includes('invalid_grant') |
| 710 | ) |
| 711 | } |
| 712 | |
| 713 | function isVertexAuthError(error: unknown): boolean { |
| 714 | if (isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX)) { |