{"record":{"id":"02e8310515ccae68","repo":"GoogleContainerTools/skaffold","slug":"starting-logger-w-02e831","errorCode":null,"errorMessage":"starting logger: %w","messagePattern":"starting logger: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/runner/dev.go","lineNumber":362,"sourceCode":"\tif err != nil {\n\t\tevent.DevLoopFailedInPhase(r.devIteration, constants.Deploy, err)\n\t\teventV2.TaskFailed(constants.DevLoop, err)\n\t\tendTrace()\n\t\treturn fmt.Errorf(\"exiting dev mode because first deploy failed: %w\", err)\n\t}\n\tr.deployManifests = manifests\n\n\tdefer r.deployer.GetAccessor().Stop()\n\n\tif err := r.deployer.GetAccessor().Start(ctx, out); err != nil {\n\t\tlog.Entry(ctx).Warn(\"Error starting resource accessor:\", err)\n\t}\n\tif err := r.deployer.GetDebugger().Start(ctx); err != nil {\n\t\tlog.Entry(ctx).Warn(\"Error starting debug container notification:\", err)\n\t}\n\t// Start printing the logs after deploy is finished\n\tif err := r.deployer.GetLogger().Start(ctx, out); err != nil {\n\t\treturn fmt.Errorf(\"starting logger: %w\", err)\n\t}\n\n\tg := getTransposeGraph(artifacts)\n\t// Watch artifacts\n\tstart := time.Now()\n\n\tif len(artifacts) > 0 {\n\t\toutput.Default.Fprintln(out, \"Listing files to watch...\")\n\t} else {\n\t\toutput.Default.Fprintln(out, \"No artifacts found to watch\")\n\t}\n\n\tfor i := range artifacts {\n\t\tartifact := artifacts[i]\n\t\tif !r.runCtx.Opts.IsTargetImage(artifact) {\n\t\t\tcontinue\n\t\t}\n","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/runner/dev.go#L344-L380","documentation":"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.","triggerScenarios":"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.","commonSituations":"Cluster unreachable after deploy; namespace does not exist so pod watching fails; kubeconfig credentials revoked mid-session; API server throttling/watch errors.","solutions":["Check the wrapped error for the logger's root cause (usually cluster/API access)","Verify the target namespace exists and is accessible: `kubectl get pods -n <ns>`","Ensure the kubectl context used by skaffold is valid and authorized","Re-run `skaffold dev`; the logger starts fresh each iteration"],"exampleFix":"// before: dev against a namespace that does not exist\ndeploy:\n  kubectl: {defaultNamespace: missing-ns}\n// after\ndeploy:\n  kubectl: {defaultNamespace: default}","handlingStrategy":"try-catch","validationCode":"// preflight: ensure pod watching works in target namespace\nkubectl get pods -n <namespace> -w --request-timeout=5s & sleep 2; kill %1","typeGuard":"if strings.Contains(err.Error(), \"starting logger\") { /* cause is the logger's Start error */ }","tryCatchPattern":"if err := runSkaffoldDev(ctx); err != nil && strings.Contains(err.Error(), \"starting logger\") {\n    log.Printf(\"logger failed to start, cause: %v\", errors.Unwrap(err))\n    // fall back to `kubectl logs -f` on the deployed pods\n}","preventionTips":["Verify namespace exists before dev","Keep kubeconfig credentials valid/refreshed","Check API server reachability with `kubectl version`","Use --namespace explicitly to avoid defaulting surprises"],"tags":["skaffold","logging","dev-loop","kubernetes"],"backgroundTag":"logger-start-failed","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"}