GoogleContainerTools/skaffold · error

StatusCode_LOG_STREAM_RUN_GCLOUD_NOT_FOUND

StatusCode_LOG_STREAM_RUN_GCLOUD_NOT_FOUND

Error message

gcloud not found

What it means

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.

Source

Thrown at pkg/skaffold/deploy/cloudrun/log.go:148

		}
	}
	return nil
}

func (r *LogAggregator) Stop() {
	for _, logTailer := range r.logTailers {
		logTailer.Stop()
	}
}

type runLogTailer struct {
	resources *loggerTracker
}

func (r *runLogTailer) Start(ctx context.Context, out io.Writer) error {
	if !gcloudInstalled() {
		output.Red.Fprintln(out, "gcloud not found on path. Unable to set up Cloud Run port forwarding")
		return sErrors.NewError(fmt.Errorf("gcloud not found"), &proto.ActionableErr{ErrCode: proto.StatusCode_LOG_STREAM_RUN_GCLOUD_NOT_FOUND})
	}
	if r.resources.resources == nil {
		return nil
	}
	syncOut := &syncWriter{w: out}
	go func() {
		for _, resource := range r.resources.resources {
			if !resource.isTailing {
				cctx, cancel := context.WithCancel(ctx)
				cmd := exec.CommandContext(cctx, "gcloud", getGcloudTailArgs(resource.name)...)
				cmd.Env = os.Environ()
				// gcloud uses buffered stream by default
				cmd.Env = append(cmd.Env, "PYTHONUNBUFFERED=1") // gcloud defaults streaming output as buffered
				pr, pw := io.Pipe()
				cmd.Stderr = pw
				cmd.Stdout = pw
				resource.cancel = cancel
				if err := cmd.Start(); err != nil {

View on GitHub (pinned to a1189de023)

Solutions

  1. Install the Google Cloud CLI (https://cloud.google.com/sdk/docs/install) so `gcloud` is on the PATH
  2. If already installed, add its bin directory to PATH (e.g. `export PATH=$PATH:/usr/local/google-cloud-sdk/bin`) and re-run
  3. If log tailing is not needed, disable Cloud Run port-forwarding/log-streaming options (e.g. `--port-forward` off) to avoid the tailer
  4. In CI, use a Google Cloud base image or add a gcloud install step before running skaffold

Example fix

// before (Dockerfile/CI without gcloud)
FROM golang:1.21
RUN skaffold deploy --cloudrun ...

// after
FROM golang:1.21
RUN curl https://sdk.cloud.google.com | bash > /dev/null && \
    mv google-cloud-sdk /usr/local/ && \
    ln -s /usr/local/google-cloud-sdk/bin/gcloud /usr/local/bin/gcloud
Defensive patterns

Strategy: validation

Validate before calling

if _, err := exec.LookPath("gcloud"); err != nil {
    // install Google Cloud SDK or add gcloud to PATH before invoking skaffold
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/bb141ffef64afeb7. Report an issue: GitHub.