(error: unknown)
| 711 | } |
| 712 | |
| 713 | function isVertexAuthError(error: unknown): boolean { |
| 714 | if (isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX)) { |
| 715 | // SDK-level: google-auth-library fails in prepareOptions() before the HTTP call |
| 716 | if (isGoogleAuthLibraryCredentialError(error)) { |
| 717 | return true |
| 718 | } |
| 719 | // Server-side: Vertex returns 401 for expired/invalid tokens |
| 720 | if (error instanceof APIError && error.status === 401) { |
| 721 | return true |
| 722 | } |
| 723 | } |
| 724 | return false |
| 725 | } |
| 726 | |
| 727 | /** |
| 728 | * Clear GCP auth caches if appropriate. |
no test coverage detected