GoogleContainerTools/skaffold · error
finding auto-activated profiles: %w
Error message
finding auto-activated profiles: %w
What it means
While applying profiles to the skaffold config, ApplyProfiles first computes which profiles are auto-activated (by kube-context, env vars, commands, or gke flags). If that evaluation itself fails — e.g. a profile activation rule references an environment variable in a way that errors — the failure is wrapped as `finding auto-activated profiles: %w`. The inner error (visible after the colon) identifies the specific activation check that failed.
Source
Thrown at pkg/skaffold/schema/profiles.go:49
kubectx "github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/kubernetes/context"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/output/log"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/parser/configlocations"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/latest"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
skutil "github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/util"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/util/stringslice"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/yaml"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/yamltags"
)
// ApplyProfiles modifies the input skaffold configuration by the application
// of a list of profiles, and returns the list of applied profiles.
func ApplyProfiles(c *latest.SkaffoldConfig, fieldsOverrodeByProfile map[string]configlocations.YAMLOverrideInfo, opts cfg.SkaffoldOptions, namedProfiles []string) ([]string, map[string]configlocations.YAMLOverrideInfo, error) {
byName := profilesByName(c.Profiles)
profiles, contextSpecificProfiles, err := activatedProfiles(c.Profiles, opts, namedProfiles)
if err != nil {
return nil, nil, fmt.Errorf("finding auto-activated profiles: %w", err)
}
for _, name := range profiles {
profile, present := byName[name]
if !present {
return nil, nil, fmt.Errorf("couldn't find profile %s", name)
}
if err := applyProfile(c, fieldsOverrodeByProfile, profile); err != nil {
return nil, nil, fmt.Errorf("applying profile %q: %w", name, err)
}
}
// remove profiles section for run modes where profiles are already merged into the main pipeline
switch opts.Mode() {
case cfg.RunModes.Build, cfg.RunModes.Dev, cfg.RunModes.Deploy, cfg.RunModes.Debug, cfg.RunModes.Render, cfg.RunModes.Run, cfg.RunModes.Diagnose, cfg.RunModes.Delete:
c.Profiles = nil
}
return profiles, fieldsOverrodeByProfile, checkKubeContextConsistency(contextSpecificProfiles, opts.KubeContext, c.Deploy.KubeContext)View on GitHub (pinned to a1189de023)
Solutions
- Read the wrapped inner error after the colon for the actual failing activation rule
- Fix or remove the offending `activation` block in skaffold.yaml (env/context/command criteria)
- Run with `--profile-auto-activation=false` or invoke the profile explicitly with `-p <name>` to bypass auto-activation
- Validate the skaffold config with `skaffold diagnose` to surface activation problems
Example fix
# before (skaffold.yaml) profiles: - name: staging activation: - env: INVALID~VAR=staging # after profiles: - name: staging activation: - env: ENV=staging
Defensive patterns
Strategy: validation
Validate before calling
for _, p := range cfg.Profiles {
for _, a := range p.Activation {
if a.Env != "" && !strings.Contains(a.Env, "=") {
return fmt.Errorf("profile %q has malformed env activation %q", p.Name, a.Env)
}
}
} Try / catch
profiles, _, err := schema.ApplyProfiles(c, overrides, opts, named)
if err != nil {
var inner error = errors.Unwrap(err)
log.Entry(context.Background()).Errorf("profile activation failed: %v (cause: %v)", err, inner)
return err
} Prevention
- Keep activation rules simple (single env/context/command criteria)
- Run `skaffold diagnose` in CI to validate activation blocks
- Use explicit `-p` profiles in CI instead of relying on auto-activation
- Avoid env activation rules for variables not guaranteed in the runtime environment
When it happens
Trigger: skaffold.yaml defines `profiles.activation` with an `env` or `gke` criterion that cannot be evaluated (e.g. malformed kube-context comparison or an environment lookup failure), and auto-activation is enabled (default). Triggered via ApplyProfiles during any config-processing run mode (dev, run, build, render, diagnose).
Common situations: Profiles with activation env rules evaluated in shells/environments where the variable is missing or invalid; corrupt or unreadable kubeconfig causing context-based activation to fail; config files generated programmatically with malformed activation blocks.
Related errors
- getting run context: %w
- couldn't find profile %s
- applying profile %q: %w
- value must be one of `always`, `missing`, or `never`
- CONFIG_REMOTE_REPO_CACHE_NOT_FOUND_ERR
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/8c09318d40b672c0.
Report an issue: GitHub.