| 658 | // google-auth-library throws plain Error (no typed name like AWS's |
| 659 | // CredentialsProviderError). Match common SDK-level credential-failure messages. |
| 660 | function isGoogleAuthLibraryCredentialError(error: unknown): boolean { |
| 661 | if (!(error instanceof Error)) return false |
| 662 | const msg = error.message |
| 663 | return ( |
| 664 | msg.includes('Could not load the default credentials') || |
| 665 | msg.includes('Could not refresh access token') || |
| 666 | msg.includes('invalid_grant') |
| 667 | ) |
| 668 | } |
| 669 | |
| 670 | function isVertexAuthError(error: unknown): boolean { |
| 671 | if (isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX)) { |