(error: unknown)
| 665 | } |
| 666 | |
| 667 | function isVertexAuthError(error: unknown): boolean { |
| 668 | if (isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX)) { |
| 669 | // SDK-level: google-auth-library fails in prepareOptions() before the HTTP call |
| 670 | if (isGoogleAuthLibraryCredentialError(error)) { |
| 671 | return true |
| 672 | } |
| 673 | // Server-side: Vertex returns 401 for expired/invalid tokens |
| 674 | if (error instanceof APIError && error.status === 401) { |
| 675 | return true |
| 676 | } |
| 677 | } |
| 678 | return false |
| 679 | } |
| 680 | |
| 681 | /** |
| 682 | * Clear GCP auth caches if appropriate. |
no test coverage detected