{"record":{"id":"191cf03332a546a5","repo":"basecamp/kamal","slug":"gcloud-cli-is-not-installed","errorCode":null,"errorMessage":"gcloud CLI is not installed","messagePattern":"gcloud CLI is not installed","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"lib/kamal/secrets/adapters/gcp_secret_manager.rb","lineNumber":93,"sourceCode":"          items[secret] = [ project, secret_name, secret_version ]\n        end\n      end\n    end\n\n    def run_command(command, project: \"default\", user: \"default\", service_account: nil)\n      full_command = [ \"gcloud\", command ]\n      full_command << \"--project=#{project.shellescape}\" unless project == \"default\"\n      full_command << \"--account=#{user.shellescape}\" unless user == \"default\"\n      full_command << \"--impersonate-service-account=#{service_account.shellescape}\" if service_account\n      full_command << \"--format=json\"\n      full_command = full_command.join(\" \")\n\n      result = `#{full_command}`.strip\n      JSON.parse(result)\n    end\n\n    def check_dependencies!\n      raise RuntimeError, \"gcloud CLI is not installed\" unless cli_installed?\n    end\n\n    def cli_installed?\n      `gcloud --version 2> /dev/null`\n      $?.success?\n    end\n\n    def logged_in?\n      JSON.parse(`gcloud auth list --format=json`).any?\n    end\n\n    def parse_account(account)\n      account.split(\"|\", 2)\n    end\n\n    def is_user?(candidate)\n      candidate.include?(\"@\")\n    end","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/basecamp/kamal/blob/eee0083b38661c3707c6b6052cc89e85038a096c/lib/kamal/secrets/adapters/gcp_secret_manager.rb#L75-L111","documentation":"Raised by check_dependencies! in Kamal::Secrets::Adapters::GcpSecretManager when `gcloud --version 2> /dev/null` exits non-zero. Base#fetch runs this probe before login and fetching, so any adapter use fails fast when the Google Cloud CLI binary is missing or unusable on PATH.","triggerScenarios":"adapter.fetch(...) (e.g. `kamal secrets pull` with adapter gcp_secret_manager) on a host without the gcloud binary on PATH: google-cloud-sdk never installed, installed via a version manager not active in the kamal process, or a broken/incompatible SDK install.","commonSituations":"Minimal Docker/CI images (gcloud is not bundled); installing via gcloud's install dir (~/$HOME/google-cloud-sdk/bin) without adding it to PATH in non-login shells; macOS where the SDK lives in ~/google-cloud-sdk but CI uses a clean shell.","solutions":["Install the Google Cloud CLI (e.g. `brew install --cask google-cloud-sdk` or the official install script) and verify `gcloud --version` in the exact environment running kamal.","Add the SDK bin dir to PATH (Dockerfile ENV PATH=..., CI export) where installing under $HOME.","Pin the SDK install/upgrade in provisioning so deploy hosts always have it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"require \"open3\"\n\ndef gcloud_installed?\n  Open3.capture3(\"gcloud\", \"--version\")[2].success?\nend\n\nabort \"Install the Google Cloud CLI (gcloud) before pulling GCP secrets\" unless gcloud_installed?","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include google-cloud-sdk in the CI image / Dockerfile used for deploys.","Check `which gcloud` in deploy preflight, especially for shells that skip profile PATH setup.","Pin an SDK version to avoid behavioral drift across runners."],"tags":["ruby","kamal","gcloud","gcp","cli","dependency","path","secrets"],"backgroundTag":"cli-not-installed","analyzedSha":"eee0083b38661c3707c6b6052cc89e85038a096c","analyzedAt":"2026-08-21T15:17:22.045Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}