GoogleContainerTools/skaffold · error

starting logger: %w

Error message

starting logger: %w

What it means

During Dev(), after deploy finishes, Skaffold starts the log streamer to print pod logs. If the logger's Start() returns an error, dev mode aborts and wraps it as 'starting logger'. This usually means the logger could not set up its pod watcher against the cluster.

Source

Thrown at pkg/skaffold/runner/dev.go:362

	if err != nil {
		event.DevLoopFailedInPhase(r.devIteration, constants.Deploy, err)
		eventV2.TaskFailed(constants.DevLoop, err)
		endTrace()
		return fmt.Errorf("exiting dev mode because first deploy failed: %w", err)
	}
	r.deployManifests = manifests

	defer r.deployer.GetAccessor().Stop()

	if err := r.deployer.GetAccessor().Start(ctx, out); err != nil {
		log.Entry(ctx).Warn("Error starting resource accessor:", err)
	}
	if err := r.deployer.GetDebugger().Start(ctx); err != nil {
		log.Entry(ctx).Warn("Error starting debug container notification:", err)
	}
	// Start printing the logs after deploy is finished
	if err := r.deployer.GetLogger().Start(ctx, out); err != nil {
		return fmt.Errorf("starting logger: %w", err)
	}

	g := getTransposeGraph(artifacts)
	// Watch artifacts
	start := time.Now()

	if len(artifacts) > 0 {
		output.Default.Fprintln(out, "Listing files to watch...")
	} else {
		output.Default.Fprintln(out, "No artifacts found to watch")
	}

	for i := range artifacts {
		artifact := artifacts[i]
		if !r.runCtx.Opts.IsTargetImage(artifact) {
			continue
		}

View on GitHub (pinned to a1189de023)

Solutions

  1. Check the wrapped error for the logger's root cause (usually cluster/API access)
  2. Verify the target namespace exists and is accessible: `kubectl get pods -n <ns>`
  3. Ensure the kubectl context used by skaffold is valid and authorized
  4. Re-run `skaffold dev`; the logger starts fresh each iteration

Example fix

// before: dev against a namespace that does not exist
deploy:
  kubectl: {defaultNamespace: missing-ns}
// after
deploy:
  kubectl: {defaultNamespace: default}
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: ensure pod watching works in target namespace
kubectl get pods -n <namespace> -w --request-timeout=5s & sleep 2; kill %1

Type guard

if strings.Contains(err.Error(), "starting logger") { /* cause is the logger's Start error */ }

Try / catch

if err := runSkaffoldDev(ctx); err != nil && strings.Contains(err.Error(), "starting logger") {
    log.Printf("logger failed to start, cause: %v", errors.Unwrap(err))
    // fall back to `kubectl logs -f` on the deployed pods
}

Prevention

When it happens

Trigger: The first dev-loop iteration reaches `r.deployer.GetLogger().Start(ctx, out)` and the logger fails, e.g. because the Kubernetes client cannot watch pods in the target namespace or the context is invalid.

Common situations: Cluster unreachable after deploy; namespace does not exist so pod watching fails; kubeconfig credentials revoked mid-session; API server throttling/watch errors.

Related errors


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