{"record":{"id":"301ee6aea605e2df","repo":"GoogleContainerTools/skaffold","slug":"invalid-path-s","errorCode":null,"errorMessage":"invalid path: %s","messagePattern":"invalid path: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/schema/profiles.go","lineNumber":300,"sourceCode":"\t\t\top = \"replace\"\n\t\t}\n\n\t\tvar value *yamlpatch.Node\n\t\tif v := patch.Value; v != nil {\n\t\t\tvalue = &v.Node\n\t\t}\n\n\t\tpatch := yamlpatch.Operation{\n\t\t\tOp:    yamlpatch.Op(op),\n\t\t\tPath:  yamlpatch.OpPath(patch.Path),\n\t\t\tFrom:  yamlpatch.OpPath(patch.From),\n\t\t\tValue: value,\n\t\t}\n\n\t\tupdated, valid := tryPatch(patch, buf)\n\t\tbuf = updated\n\t\tif !valid {\n\t\t\treturn fmt.Errorf(\"invalid path: %s\", patch.Path)\n\t\t}\n\n\t\t// TODO(aaron-prindle) we can ignore - op:'remove' - patch profiles as there is no corresponding schema object for them (it is removed already)\n\t\tyamlOverrideInfo := configlocations.YAMLOverrideInfo{\n\t\t\tProfileName:    profile.Name,\n\t\t\tPatchOperation: string(patch.Op),\n\t\t\tPatchIndex:     i,\n\t\t}\n\t\tif patch.Op == \"copy\" {\n\t\t\tyamlOverrideInfo.PatchCopyFrom = patch.From.String()\n\t\t}\n\t\tif patch.Op != \"remove\" { // TODO(aaron-prindle) yamlpatch lib doesn't export op types, should copy paste the types elsewhere and refer to that here\n\t\t\tfieldsOverrodeByProfile[string(patch.Path)] = yamlOverrideInfo\n\t\t}\n\t}\n\n\tif err != nil {\n\t\treturn err","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/profiles.go#L282-L318","documentation":"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>`.","triggerScenarios":"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.","commonSituations":"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.","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`)"],"exampleFix":"# before\npatches:\n  - op: replace\n    path: build/artifacts/0/image   # missing leading slash, invalid pointer\n    value: gcr.io/proj/img\n# after\npatches:\n  - op: replace\n    path: /build/artifacts/0/image\n    value: gcr.io/proj/img","handlingStrategy":"validation","validationCode":"yq '.profiles[].patches[].path' skaffold.yaml | grep -v '^/' && echo 'paths must be JSON pointers'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use leading-slash JSON pointers","Use op:add when target may not exist","Re-check paths after schema upgrades"],"tags":["configuration","yaml-patch","schema"],"backgroundTag":"invalid-patch-path","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"}