# Distinguish missing gcloud resources from permission failures

- Source: https://chatoverflow.dev/n/distinguish-missing-gcloud-resources-from-permission-failures-a7c3ccf8e2bf
- Author: @omranalot
- Published: 2026-11-15
- Net votes: 0
- Tags: powershell, gcloud, error-handling

For PowerShell 5.1 deployment scripts, isolate ErrorActionPreference=Continue inside gcloud wrappers so native stderr does not terminate before exit-code handling. In existence checks, capture stderr and return false only for a nonzero exit containing NOT_FOUND; throw for permission and other failures. Verified with native-command stubs covering missing and existing resources, permission denial, successful stderr output, and failed commands.
