{"record":{"id":"5f5fbafc3d6566c6","repo":"GoogleContainerTools/skaffold","slug":"getting-cluster-w","errorCode":null,"errorMessage":"getting cluster: %w","messagePattern":"getting cluster: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/runner/runcontext/context.go","lineNumber":442,"sourceCode":"\t}\n\tregList = append(regList, cfgRegistries...)\n\tinsecureRegistries := make(map[string]bool, len(regList))\n\tfor _, r := range regList {\n\t\tinsecureRegistries[r] = true\n\t}\n\tps := NewPipelines(pipelines, orderedConfigs)\n\n\t// TODO(https://github.com/GoogleContainerTools/skaffold/issues/3668):\n\t// remove minikubeProfile from here and instead detect it by matching the\n\t// kubecontext API Server to minikube profiles\n\tcluster, err := config.GetCluster(ctx, config.GetClusterOpts{\n\t\tConfigFile:      opts.GlobalConfig,\n\t\tDefaultRepo:     opts.DefaultRepo,\n\t\tMinikubeProfile: opts.MinikubeProfile,\n\t\tDetectMinikube:  opts.DetectMinikube,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting cluster: %w\", err)\n\t}\n\n\trunID := uuid.New().String()\n\n\treturn &RunContext{\n\t\tOpts:               opts,\n\t\tPipelines:          ps,\n\t\tWorkingDir:         cwd,\n\t\tKubeContext:        kubeContext,\n\t\tInsecureRegistries: insecureRegistries,\n\t\tCluster:            cluster,\n\t\tRunID:              runID,\n\t}, nil\n}\n","sourceCodeStart":424,"sourceCodeEnd":457,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/runner/runcontext/context.go#L424-L457","documentation":"As part of RunContext construction, Skaffold determines the target cluster (including minikube detection via cluster.GetCluster with the global config, default repo, and minikube options). Failure at this step is wrapped as \"getting cluster: %w\" and aborts runner/context creation.","triggerScenarios":"Calling GetRunContext/NewForConfig when the cluster detection call (cluster.GetCluster with DetectMinikube, MinikubeProfile, DefaultRepo, GlobalConfig) returns an error — e.g. failure inspecting kubectl contexts or minikube profile lookup.","commonSituations":"minikube profile specified but not running/installed, kubectl context pointing to an unreachable cluster during detection, or malformed global config (~/.skaffold/config) affecting cluster resolution.","solutions":["Read the wrapped cause after 'getting cluster:' for the real failure","Verify the cluster is reachable: `kubectl cluster-info`","If using --minikube-profile, confirm the profile exists (`minikube profile list`) and is running","Reset a corrupt skaffold global config: `skaffold config` entries or delete ~/.skaffold/config"],"exampleFix":"// before\nskaffold dev --minikube-profile=missing-profile\n// after\nminikube start -p myprofile\nskaffold dev --minikube-profile=myprofile","handlingStrategy":"try-catch","validationCode":"if err := exec.Command(\"kubectl\", \"cluster-info\").Run(); err != nil { return fmt.Errorf(\"cluster unreachable before skaffold run: %w\", err) }","typeGuard":null,"tryCatchPattern":"runCtx, err := GetRunContext(config, opts)\nif err != nil && strings.Contains(err.Error(), \"getting cluster\") {\n    return nil, fmt.Errorf(\"cluster detection failed; check kubectl context and minikube profile: %v\", err)\n}\nreturn runCtx, err","preventionTips":["Verify cluster reachability (`kubectl cluster-info`) before running skaffold","Confirm minikube profiles exist when using --minikube-profile","Keep ~/.skaffold/config free of stale cluster entries"],"tags":["skaffold","kubernetes","cluster","minikube","go"],"backgroundTag":"cluster-detection-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"}