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