{"record":{"id":"b22aa550e9d9844b","repo":"GoogleContainerTools/skaffold","slug":"statuscode-deploy-read-manifest-err","errorCode":"StatusCode_DEPLOY_READ_MANIFEST_ERR","errorMessage":"unable to unmarshal Cloud Run Service config: %w","messagePattern":"unable to unmarshal Cloud Run Service config: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/deploy/cloudrun/deploy.go","lineNumber":526,"sourceCode":"\t\t\t}\n\t\tcase tpe == typeWorkerPool:\n\t\t\terr := d.deleteRunWorkerPool(crclient, out, dryRun, manifest)\n\t\t\tif err != nil {\n\t\t\t\terrors = append(errors, err)\n\t\t\t}\n\t\t}\n\t}\n\tif len(errors) != 0 {\n\t\t// TODO: is there a good way to report all of the errors?\n\t\treturn errors[0]\n\t}\n\treturn nil\n}\n\nfunc (d *Deployer) deleteRunService(crclient *run.APIService, out io.Writer, dryRun bool, manifest []byte) error {\n\tservice := &run.Service{}\n\tif err := k8syaml.Unmarshal(manifest, service); err != nil {\n\t\treturn sErrors.NewError(fmt.Errorf(\"unable to unmarshal Cloud Run Service config: %w\", err), &proto.ActionableErr{\n\t\t\tMessage: err.Error(),\n\t\t\tErrCode: proto.StatusCode_DEPLOY_READ_MANIFEST_ERR,\n\t\t})\n\t}\n\n\tvar projectID string\n\tswitch {\n\tcase d.Project != \"\":\n\t\tprojectID = d.Project\n\tcase service.Metadata.Namespace != \"\":\n\t\tprojectID = service.Metadata.Namespace\n\tdefault:\n\t\t// no project specified, we don't know what to delete.\n\t\treturn sErrors.NewError(fmt.Errorf(\"unable to determine Google Cloud Project\"), &proto.ActionableErr{\n\t\t\tMessage: \"No Google Cloud Project found in Cloud Run manifest or Skaffold Manifest.\",\n\t\t\tErrCode: proto.StatusCode_DEPLOY_READ_MANIFEST_ERR,\n\t\t})\n\t}","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/deploy/cloudrun/deploy.go#L508-L544","documentation":"During cleanup, deleteRunService unmarshals each rendered Cloud Run Service manifest into run.Service. If k8syaml.Unmarshal fails (malformed YAML or fields incompatible with run.Service), the service cannot be deleted and DEPLOY_READ_MANIFEST_ERR is returned, aborting cleanup of that resource.","triggerScenarios":"deleteRunService calls k8syaml.Unmarshal(manifest, service) on manifests fetched from skaffold's rendered output or a stored Cloud Run state file that is corrupted, truncated, or has wrong-typed fields for run.Service.","commonSituations":"Corrupted/truncated rendered-manifests cache between runs; a manifest edited after render; wrong kind captured for a Service slot; schema drift causing type mismatches (e.g. ports as strings).","solutions":["Re-render the manifests (`skaffold render`) to regenerate clean output and clear stale state","Validate the YAML syntax and fix indentation/typing issues","Ensure the manifest is a Cloud Run Service (kind: Service, run.googleapis.com) matching the v1 schema","Manually delete the resource with `gcloud run services delete` if cleanup remains blocked"],"exampleFix":"// before (ports typed wrong)\ncontainers:\n- image: img:latest\n  ports: \"8080\"\n// after\ncontainers:\n- image: img:latest\n  ports:\n  - containerPort: 8080","handlingStrategy":"validation","validationCode":"func validateServiceManifest(manifest []byte) error {\n    var m map[string]interface{}\n    if err := yaml.Unmarshal(manifest, &m); err != nil {\n        return fmt.Errorf(\"invalid YAML: %w\", err)\n    }\n    if m[\"kind\"] != \"Service\" {\n        return fmt.Errorf(\"expected kind Service, got %v\", m[\"kind\"])\n    }\n    return nil\n}","typeGuard":"func isCloudRunService(m map[string]interface{}) bool {\n    kind, _ := m[\"kind\"].(string)\n    return kind == \"Service\"\n}","tryCatchPattern":"err := deployer.Cleanup(ctx, out)\nif err != nil {\n    var actionErr *sErrors.Error\n    if errors.As(err, &actionErr) && actionErr.ErrCode == proto.StatusCode_DEPLOY_READ_MANIFEST_ERR {\n        // re-render manifests or fall back to `gcloud run services delete`\n    }\n    return err\n}","preventionTips":["Re-run `skaffold render` if cached rendered manifests look stale","Keep rendered manifests unmodified after generation","Add CI validation of rendered output before deploy/cleanup","Fall back to `gcloud run services delete` when cleanup is blocked by a corrupt manifest"],"tags":["cloud-run","cleanup","unmarshal","yaml"],"backgroundTag":"manifest-unmarshal-failed","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"}