{"record":{"id":"1841cb8dccc0ed0c","repo":"GoogleContainerTools/skaffold","slug":"s-is-not-a-valid-kubernetes-manifest","errorCode":null,"errorMessage":"%s is not a valid Kubernetes manifest","messagePattern":"(.+?) is not a valid Kubernetes manifest","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/skaffold/app/cmd/apply.go","lineNumber":79,"sourceCode":"\tif err := validateManifests(args); err != nil {\n\t\treturn err\n\t}\n\treturn withRunner(ctx, out, func(r runner.Runner, configs []util.VersionedConfig) error {\n\t\treturn r.Apply(ctx, out)\n\t})\n}\n\nfunc validateManifests(manifests []string) error {\n\tfor _, m := range manifests {\n\t\tif _, err := os.Open(m); err != nil {\n\t\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\t\treturn fmt.Errorf(\"cannot find provided file %s\", m)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"unable to open provided file %s\", m)\n\t\t}\n\n\t\tif _, err := kubernetes.ParseKubernetesObjects(m); err != nil {\n\t\t\treturn errors.Wrap(err, fmt.Sprintf(\"%s is not a valid Kubernetes manifest\", m))\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":61,"sourceCodeEnd":84,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/cmd/skaffold/app/cmd/apply.go#L61-L84","documentation":"validateManifests, invoked by doApply in `skaffold apply`, parses each manifest file supplied on the command line with kubernetes.ParseKubernetesObjects. If parsing or object validation fails for a file, the error is wrapped as \"<file> is not a valid Kubernetes manifest\" so the user knows exactly which file is rejected.","triggerScenarios":"Running `skaffold apply -m file.yaml` where the file fails ParseKubernetesObjects: it is not YAML/JSON, contains no Kubernetes objects, has an unknown apiVersion/kind, or contains YAML that decodes to a non-object (e.g. a List of strings or plain text).","commonSituations":"Pointing -m at a docker-compose file, Helm values file, kustomization.yaml, or a template file with unresolved {{ }} placeholders; passing a multi-doc file where one doc is invalid; typos in apiVersion/kind; YAML with tabs or encoding issues.","solutions":["Open the named file and run `kubectl apply --dry-run=client -f <file>` to reproduce and see the parser's detailed error.","Remove non-Kubernetes files from the -m list; only pass actual resource manifests.","Render templates before applying (e.g. helm template / envsubst) so no unresolved placeholders reach skaffold apply.","Fix apiVersion/kind typos or invalid YAML syntax (tabs, bad indentation) reported by the parser.","If the file intentionally holds no objects, drop it or empty it from the apply arguments."],"exampleFix":"// before (shell)\nskaffold apply -m manifest.tmpl\n// after\nenvsubst < manifest.tmpl > manifest.yaml\nskaffold apply -m manifest.yaml","handlingStrategy":"validation","validationCode":"# validate every -m file before running skaffold apply\nfor f in $MANIFESTS; do\n  kubectl apply --dry-run=client -f \"$f\" > /dev/null || { echo \"invalid: $f\"; exit 1; }\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only pass real Kubernetes resource manifests to skaffold apply -m.","Render templates (helm template / envsubst) before apply.","Lint manifests in CI with `kubectl apply --dry-run=client` or kubeconform."],"tags":["kubernetes","yaml","validation","cli"],"backgroundTag":"invalid-kubernetes-manifest","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"}