{"record":{"id":"a11f2c4dd330ca3e","repo":"kubernetes/kops","slug":"expected-exactly-one-object-in-manifest-s-found-a11f2c","errorCode":null,"errorMessage":"expected exactly one object in manifest %s, found %d","messagePattern":"expected exactly one object in manifest (.+?), found (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/components/kubeapiserver/model.go","lineNumber":127,"sourceCode":"      type: Directory\n`\n\n// buildHealthcheckSidecar builds the partial pod for the healthcheck sidecar.\n// nodeup will merge it into the kube-apiserver pod.\nfunc (b *KubeApiserverBuilder) buildHealthcheckSidecar() (*corev1.Pod, error) {\n\t// TODO: pull from bundle\n\tbundle := \"(embedded kube-apiserver-healthcheck manifest)\"\n\tmanifest := []byte(fmt.Sprintf(defaultManifest, kopsversion.KopsVersionImageTag(), wellknownports.KubeAPIServerHealthCheck))\n\n\tvar pod *corev1.Pod\n\tvar container *corev1.Container\n\t{\n\t\tobjects, err := model.ParseManifest(manifest)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(objects) != 1 {\n\t\t\treturn nil, fmt.Errorf(\"expected exactly one object in manifest %s, found %d\", bundle, len(objects))\n\t\t}\n\t\tif podObject, ok := objects[0].(*corev1.Pod); !ok {\n\t\t\treturn nil, fmt.Errorf(\"expected Pod object in manifest %s, found %T\", bundle, objects[0])\n\t\t} else {\n\t\t\tpod = podObject\n\t\t}\n\n\t\tif len(pod.Spec.Containers) != 1 {\n\t\t\treturn nil, fmt.Errorf(\"expected exactly one container in etcd-manager Pod, found %d\", len(pod.Spec.Containers))\n\t\t}\n\t\tcontainer = &pod.Spec.Containers[0]\n\t}\n\n\t// Remap image via AssetBuilder\n\tcontainer.Image = b.AssetBuilder.RemapImage(container.Image)\n\n\treturn pod, nil\n}","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/components/kubeapiserver/model.go#L109-L145","documentation":"buildHealthcheckSidecar loads the bundled etcd-manager healthcheck sidecar manifest (from the embedded bundle file) and parses it with model.ParseManifest, then asserts it contains exactly one object. If the parsed manifest holds a different number of objects, it returns this error naming the bundle path. This validates the integrity of the asset baked into the kOps binary.","triggerScenarios":"kops update cluster where the embedded healthcheck sidecar bundle file was corrupted, replaced, or contains multiple YAML documents — e.g. a broken kOps build or a modified assets bundle.","commonSituations":"Home-built or patched kOps binaries with edited bundle files, corrupted GO embed, or using a dev build whose bundle content drifted from expectations.","solutions":["Rebuild/download an official kOps release so the embedded bundle matches expectations","Inspect the bundle file at the path shown in the error and remove extra YAML documents","Verify no build tooling rewrites files under the embedded assets directory","File an upstream issue if it occurs on an official release"],"exampleFix":"// before: bundle contains Pod + Service\n---\napiVersion: v1\nkind: Pod\n---\napiVersion: v1\nkind: Service\n// after: keep exactly one Pod document\napiVersion: v1\nkind: Pod","handlingStrategy":"validation","validationCode":"// Verify bundle integrity before invoking the model\nobjects, err := model.ParseManifest(bundleBytes)\nif err != nil {\n    return err\n}\nif len(objects) != 1 {\n    return fmt.Errorf(\"sidecar bundle must contain exactly one object, got %d\", len(objects))\n}","typeGuard":null,"tryCatchPattern":"pod, err := buildHealthcheckSidecar(ctx, b, bundle)\nif err != nil {\n    if strings.Contains(err.Error(), \"expected exactly one object\") {\n        return fmt.Errorf(\"embedded sidecar bundle corrupted — reinstall official kOps: %w\", err)\n    }\n    return err\n}","preventionTips":["Never edit files under the embedded assets/bundle directory in forks","Use checksum-verified official kOps binaries","Keep bundle files single-document YAML"],"tags":["kube-apiserver","healthcheck","manifest-parsing"],"backgroundTag":"unexpected-manifest-object-count","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}