GoogleContainerTools/skaffold · error
INSPECT_PROFILE_NOT_FOUND_ERR
INSPECT_PROFILE_NOT_FOUND_ERR
Error message
trying to modify a profile %q that doesn't exist
What it means
Skaffold's inspect API throws this when an operation (e.g. modifying a Cloud Build environment via `skaffold inspect`) targets a named profile that is not defined in skaffold.yaml. ProfileNotFound builds an actionable error with code INSPECT_PROFILE_NOT_FOUND_ERR so CLI clients get a machine-readable message plus a suggestion to fix the input.
Source
Thrown at pkg/skaffold/inspect/errors.go:72
msg = fmt.Sprintf("trying to modify a %q build environment definition that doesn't exist, in profile %q in file %s", b, profile, filename)
}
return sErrors.NewError(errors.New(msg),
&proto.ActionableErr{
Message: msg,
ErrCode: proto.StatusCode_INSPECT_BUILD_ENV_INCORRECT_TYPE_ERR,
Suggestions: []*proto.Suggestion{
{
SuggestionCode: proto.SuggestionCode_INSPECT_USE_ADD_BUILD_ENV,
Action: "Check that the target build environment definition already exists. Otherwise use the `add` command instead of the `modify` command to create it",
},
},
})
}
// ProfileNotFound specifies that the target profile doesn't exist
func ProfileNotFound(profile string) error {
msg := fmt.Sprintf("trying to modify a profile %q that doesn't exist", profile)
return sErrors.NewError(errors.New(msg),
&proto.ActionableErr{
Message: msg,
ErrCode: proto.StatusCode_INSPECT_PROFILE_NOT_FOUND_ERR,
Suggestions: []*proto.Suggestion{
{
SuggestionCode: proto.SuggestionCode_INSPECT_CHECK_INPUT_PROFILE,
Action: "Check that the `--profile` flag matches at least one existing profile. Otherwise use the `add` command instead of the `modify` command to create it",
},
},
})
}
View on GitHub (pinned to a1189de023)
Solutions
- Run `skaffold inspect profiles` (or read skaffold.yaml) to list valid profiles and correct the --profile value
- Add the missing profile to skaffold.yaml under `profiles:` with the exact name referenced
- Check for profile definitions in included/imported config files and merge them before invoking inspect commands
Example fix
// before skaffold inspect modify-cloudrun-build-env --profile prod-1 // after skaffold inspect profiles # confirm exact name, then skaffold inspect modify-cloudrun-build-env --profile prod
Defensive patterns
Strategy: validation
Validate before calling
profiles, err := inspectProfiles(skaffoldConfig)
if !slices.Contains(profiles, requestedProfile) {
return fmt.Errorf("profile %q not defined in skaffold.yaml; run `skaffold inspect profiles`", requestedProfile)
} Type guard
func hasProfile(cfg *latest.SkaffoldConfig, name string) bool {
for _, p := range cfg.Profiles { if p.Name == name { return true } }
return false
} Try / catch
if err := modifyGcbBuildEnv(profile); err != nil {
var ae *proto.ActionableErr
if status.Code(err) == codes.Unknown && strings.Contains(err.Error(), profile) { /* handle profile-not-found */ }
return err
} Prevention
- List profiles with `skaffold inspect profiles` before mutating
- Keep profile names in CI variables synced with skaffold.yaml
- Validate merged config when using required configs/overlays
When it happens
Trigger: Calling ModifyGcbBuildEnv (or other inspect mutation endpoints) with a --profile value that does not exist in the parsed skaffold.yaml.
Common situations: Typo in the profile name on the command line; profile defined only in an overlay/other file; renamed or deleted profile while CI scripts still reference the old name.
Related errors
- cannot resolve active Kubernetes context - multiple contexts
- filename not specified
- getting run context: %w
- getting tagger: %w
- validating upgraded config: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/859ef7b7bf23e3dc.
Report an issue: GitHub.