GoogleContainerTools/skaffold · error
invalid path: %s
Error message
invalid path: %s
What it means
Profiles can modify the config with JSON/YAML patch fragments (`profile.patches`) using RFC-6902-style paths. `applyProfile` (pkg/skaffold/schema/profiles.go:300) applies each patch to the marshaled config and calls `tryPatch`; if the patched result is invalid — typically because the patch `path` does not resolve in the Skaffold config document — it returns `invalid path: <path>`.
Source
Thrown at pkg/skaffold/schema/profiles.go:300
op = "replace"
}
var value *yamlpatch.Node
if v := patch.Value; v != nil {
value = &v.Node
}
patch := yamlpatch.Operation{
Op: yamlpatch.Op(op),
Path: yamlpatch.OpPath(patch.Path),
From: yamlpatch.OpPath(patch.From),
Value: value,
}
updated, valid := tryPatch(patch, buf)
buf = updated
if !valid {
return fmt.Errorf("invalid path: %s", patch.Path)
}
// TODO(aaron-prindle) we can ignore - op:'remove' - patch profiles as there is no corresponding schema object for them (it is removed already)
yamlOverrideInfo := configlocations.YAMLOverrideInfo{
ProfileName: profile.Name,
PatchOperation: string(patch.Op),
PatchIndex: i,
}
if patch.Op == "copy" {
yamlOverrideInfo.PatchCopyFrom = patch.From.String()
}
if patch.Op != "remove" { // TODO(aaron-prindle) yamlpatch lib doesn't export op types, should copy paste the types elsewhere and refer to that here
fieldsOverrodeByProfile[string(patch.Path)] = yamlOverrideInfo
}
}
if err != nil {
return errView on GitHub (pinned to a1189de023)
Solutions
- Fix the patch `path` in skaffold.yaml to match the actual config structure (run `skaffold diagnose` to dump the parsed config and verify field names)
- If the target may not exist, use `op: add` instead of `replace`, or add the parent node first
- Check array indices in the path against the current artifact/profile order; prefer stable ordering or select by content
- After a skaffold version upgrade, verify patch paths against the new schema (fields may have moved, e.g. under `deploy` or `portForward`)
Example fix
# before
patches:
- op: replace
path: build/artifacts/0/image # missing leading slash, invalid pointer
value: gcr.io/proj/img
# after
patches:
- op: replace
path: /build/artifacts/0/image
value: gcr.io/proj/img Defensive patterns
Strategy: validation
Validate before calling
yq '.profiles[].patches[].path' skaffold.yaml | grep -v '^/' && echo 'paths must be JSON pointers'
Prevention
- Use leading-slash JSON pointers
- Use op:add when target may not exist
- Re-check paths after schema upgrades
When it happens
Trigger: A profile in skaffold.yaml defines `patches:` with an `op: replace/add/copy` whose `path` (e.g. `/build/artifacts/0/image`) does not exist or does not match the config schema at that location, so the yaml-patch library cannot produce a valid merged document. Wrapped as `applying profile "X": invalid path: ...` by ApplyProfiles.
Common situations: Typos in JSON-pointer paths or missing the leading `/`; wrong array index (artifact order changed); patching a field that was removed/renamed in a newer skaffold schema version; using `replace` on a path that must first be `add`ed; copy/move paths referencing nonexistent locations.
Related errors
- applying profile %q: %w
- invalid env variable format: %s, should be KEY=VALUE
- value must be one of `always`, `missing`, or `never`
- CONFIG_REMOTE_REPO_CACHE_NOT_FOUND_ERR
- CONFIG_REMOTE_REPO_CACHE_NOT_FOUND_ERR
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/301ee6aea605e2df.
Report an issue: GitHub.