{"record":{"id":"9da3564951016caa","repo":"GoogleContainerTools/skaffold","slug":"profiles-q-were-activated-by-kube-context-q-but","errorCode":null,"errorMessage":"profiles %q were activated by kube-context %q, but the effective kube-context is %q -- please revise your `profiles.activation` and `deploy.kubeContext` configurations","messagePattern":"profiles %q were activated by kube-context %q, but the effective kube-context is %q -- please revise your `profiles\\.activation` and `deploy\\.kubeContext` configurations","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/schema/profiles.go","lineNumber":87,"sourceCode":"\nfunc checkKubeContextConsistency(contextSpecificProfiles []string, cliContext, effectiveContext string) error {\n\t// cli flag takes precedence\n\tif cliContext != \"\" {\n\t\treturn nil\n\t}\n\n\tkubeConfig, err := kubectx.CurrentConfig()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting current cluster context: %w\", err)\n\t}\n\tcurrentContext := kubeConfig.CurrentContext\n\n\t// nothing to do\n\tif effectiveContext == \"\" || effectiveContext == currentContext || len(contextSpecificProfiles) == 0 {\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"profiles %q were activated by kube-context %q, but the effective kube-context is %q -- please revise your `profiles.activation` and `deploy.kubeContext` configurations\", contextSpecificProfiles, currentContext, effectiveContext)\n}\n\n// activatedProfiles returns the activated profiles and activated profiles which are kube-context specific.\n// The latter matters for error reporting when the effective kube-context changes.\nfunc activatedProfiles(profiles []latest.Profile, opts cfg.SkaffoldOptions, namedProfiles []string) ([]string, []string, error) {\n\tvar activated []string\n\tvar contextSpecificProfiles []string\n\n\tif opts.ProfileAutoActivation {\n\t\t// Auto-activated profiles\n\t\tfor _, profile := range profiles {\n\t\t\tisActivated, isCtxSpecific, err := isProfileActivated(profile, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\n\t\t\tif isActivated {\n\t\t\t\tif isCtxSpecific {","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/profiles.go#L69-L105","documentation":"Skaffold profiles can be auto-activated by kube-context (`profiles.activation.kubeContext`). After applying profiles, `checkKubeContextConsistency` (pkg/skaffold/schema/profiles.go:87) verifies that profiles which were activated by the *current* kube-context are consistent with the *effective* kube-context (`deploy.kubeContext`). If they diverge, activating those context-specific profiles would silently target the wrong cluster, so Skaffold fails fast with this message naming the activated profiles and both contexts.","triggerScenarios":"Running skaffold (dev/run/deploy/etc.) when: (1) a profile was auto-activated because its `activation.kubeContext` matches the kubectl current-context (e.g. `minikube`), and (2) no `--kube-context` CLI flag was passed (the CLI flag short-circuits the check), and (3) `deploy.kubeContext` in skaffold.yaml is set to a different context than the current one. Called from ApplyProfiles at the end of profile merging.","commonSituations":"A developer on `minikube` has a profile that activates on `minikube`, but skaffold.yaml also pins `deploy.kubeContext: gke_my-project`; switching kubeconfig's current-context (e.g. after `kubectx`) while leaving `deploy.kubeContext` stale; teams sharing skaffold.yaml where one member's cluster is named differently; CI machines where kubectl current-context differs from the deploy target.","solutions":["Pass the CLI flag `--kube-context <context>` equal to the context that should be used — the CLI flag bypasses this consistency check entirely","Align `deploy.kubeContext` in skaffold.yaml with the kube-context that triggers the activation (or remove `deploy.kubeContext` so the current-context is used)","Change the profile's `activation.kubeContext` value to match the effective `deploy.kubeContext`, or remove the kube-context activation condition","Run `kubectl config current-context` and make sure your kubeconfig current-context matches `deploy.kubeContext` before running skaffold"],"exampleFix":"# before\nprofiles:\n  - name: staging\n    activation:\n      - kubeContext: minikube\ndeploy:\n  kubeContext: gke_proj_us-central1\n# after\nprofiles:\n  - name: staging\n    activation:\n      - kubeContext: gke_proj_us-central1\ndeploy:\n  kubeContext: gke_proj_us-central1","handlingStrategy":"validation","validationCode":"ctx=$(kubectl config current-context); eff=$(yq '.deploy.kubeContext // \"\"' skaffold.yaml); if [ -n \"$eff\" ] && [ \"$eff\" != \"$ctx\" ]; then echo \"use --kube-context or fix deploy.kubeContext\"; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep deploy.kubeContext consistent with activation.kubeContext","Pass --kube-context in CI to bypass current-context checks","Run kubectl config current-context before skaffold runs"],"tags":["kubernetes","kube-context","configuration"],"backgroundTag":"kube-context-mismatch","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"}