{"record":{"id":"bb141ffef64afeb7","repo":"GoogleContainerTools/skaffold","slug":"statuscode-log-stream-run-gcloud-not-found","errorCode":"StatusCode_LOG_STREAM_RUN_GCLOUD_NOT_FOUND","errorMessage":"gcloud not found","messagePattern":"gcloud not found","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/deploy/cloudrun/log.go","lineNumber":148,"sourceCode":"\t\t}\n\t}\n\treturn nil\n}\n\nfunc (r *LogAggregator) Stop() {\n\tfor _, logTailer := range r.logTailers {\n\t\tlogTailer.Stop()\n\t}\n}\n\ntype runLogTailer struct {\n\tresources *loggerTracker\n}\n\nfunc (r *runLogTailer) Start(ctx context.Context, out io.Writer) error {\n\tif !gcloudInstalled() {\n\t\toutput.Red.Fprintln(out, \"gcloud not found on path. Unable to set up Cloud Run port forwarding\")\n\t\treturn sErrors.NewError(fmt.Errorf(\"gcloud not found\"), &proto.ActionableErr{ErrCode: proto.StatusCode_LOG_STREAM_RUN_GCLOUD_NOT_FOUND})\n\t}\n\tif r.resources.resources == nil {\n\t\treturn nil\n\t}\n\tsyncOut := &syncWriter{w: out}\n\tgo func() {\n\t\tfor _, resource := range r.resources.resources {\n\t\t\tif !resource.isTailing {\n\t\t\t\tcctx, cancel := context.WithCancel(ctx)\n\t\t\t\tcmd := exec.CommandContext(cctx, \"gcloud\", getGcloudTailArgs(resource.name)...)\n\t\t\t\tcmd.Env = os.Environ()\n\t\t\t\t// gcloud uses buffered stream by default\n\t\t\t\tcmd.Env = append(cmd.Env, \"PYTHONUNBUFFERED=1\") // gcloud defaults streaming output as buffered\n\t\t\t\tpr, pw := io.Pipe()\n\t\t\t\tcmd.Stderr = pw\n\t\t\t\tcmd.Stdout = pw\n\t\t\t\tresource.cancel = cancel\n\t\t\t\tif err := cmd.Start(); err != nil {","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/deploy/cloudrun/log.go#L130-L166","documentation":"Skaffold's Cloud Run log tailer requires the Google Cloud CLI (`gcloud`) to set up port forwarding for Cloud Run services. Before starting the log stream, `runLogTailer.Start` checks whether `gcloud` is on the PATH; if not, it prints a message to the output writer and fails with StatusCode_LOG_STREAM_RUN_GCLOUD_NOT_FOUND. This is an environment prerequisite error, not a code bug.","triggerScenarios":"Running `skaffold run/dev/deploy` with a Cloud Run deployer (`deploy.cloudrun`) when the `gcloud` binary is not installed or is not on the PATH. Start() is invoked by the deploy loop to tail logs and set up port forwarding.","commonSituations":"Developer machine without Google Cloud SDK installed; gcloud installed but PATH not updated (e.g. installed via apt to a nonstandard location); running inside a CI container image lacking gcloud; using a minimal devcontainer.","solutions":["Install the Google Cloud CLI (https://cloud.google.com/sdk/docs/install) so `gcloud` is on the PATH","If already installed, add its bin directory to PATH (e.g. `export PATH=$PATH:/usr/local/google-cloud-sdk/bin`) and re-run","If log tailing is not needed, disable Cloud Run port-forwarding/log-streaming options (e.g. `--port-forward` off) to avoid the tailer","In CI, use a Google Cloud base image or add a gcloud install step before running skaffold"],"exampleFix":"// before (Dockerfile/CI without gcloud)\nFROM golang:1.21\nRUN skaffold deploy --cloudrun ...\n\n// after\nFROM golang:1.21\nRUN curl https://sdk.cloud.google.com | bash > /dev/null && \\\n    mv google-cloud-sdk /usr/local/ && \\\n    ln -s /usr/local/google-cloud-sdk/bin/gcloud /usr/local/bin/gcloud","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(\"gcloud\"); err != nil {\n    // install Google Cloud SDK or add gcloud to PATH before invoking skaffold\n}\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install Google Cloud SDK in every environment (dev machine, CI image, devcontainer) that runs Cloud Run deploys","Add a preflight PATH check for gcloud in CI pipelines before invoking skaffold","Pin gcloud installation in Dockerfiles and symlink into /usr/local/bin"],"tags":["cloudrun","gcloud","environment","deploy"],"backgroundTag":"missing-binary-on-path","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}