{"record":{"id":"04556c712604231a","repo":"rancher/rancher","slug":"unable-to-add-helm-chart-s-to-index-w","errorCode":null,"errorMessage":"unable to add helm chart %s to index: %w","messagePattern":"unable to add helm chart (.+?) to index: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/catalogv2/oci/oci.go","lineNumber":356,"sourceCode":"\t\t\treturn\n\t\t}\n\t}\n\n\t// Make sure to convert + to _ since OCI registries do not support + in tags and Helm converts it to _ while fetching the chart.\n\toriginalTag := ociClient.tag\n\tociClient.tag = strings.ReplaceAll(ociClient.tag, \"+\", \"_\")\n\n\t// Fetch the helm chart tar to get the Chart.yaml\n\tfilePath, err = ociClient.fetchChart(orasRepository)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to fetch the helm chart %s: %w\", ociURL, err)\n\t\treturn\n\t}\n\n\t// Add the chart to the index\n\terr = ociClient.addToIndex(indexFile, filePath)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"unable to add helm chart %s to index: %w\", ociURL, err)\n\t}\n\n\t// Replace it back so that further comparisons can continue\n\tociClient.tag = originalTag\n\n\t// Remove the entry from the indexfile since the next function addToIndex\n\t// will add. This is done to avoid duplication.\n\tfor index, entry := range indexFile.Entries[chartName] {\n\t\tif entry.Metadata.Name == chartName && entry.Version == ociClient.tag && entry.Digest == \"\" {\n\t\t\tindexFile.Entries[chartName] = append(indexFile.Entries[chartName][:index], indexFile.Entries[chartName][index+1:]...)\n\t\t}\n\t}\n\n\t// We load index into memory and so we should set a limit\n\t// to the size of the index file that is being created.\n\tindexFileBytes, err = json.Marshal(indexFile)\n\tif err != nil {\n\t\treturn","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/rancher/rancher/blob/932558d4e68565aff2d2f36e89ec4a391b06e7c5/pkg/catalogv2/oci/oci.go#L338-L374","documentation":"fetchChart downloaded the chart tar, but addToIndex failed: loader.Load could not parse the temp file as a Helm chart archive, digestFile failed to hash it, or indexFile.MustAdd rejected the entry. The layer bytes with the Helm media type are not actually a valid chart tarball.","triggerScenarios":"A layer labeled application/vnd.cncf.helm.chart.content.v1.tar+gzip whose content is not a Helm chart archive; corrupted or truncated push; unreadable temp file (disk pressure).","commonSituations":"Hand-crafted artifacts with Helm media types wrapping arbitrary tars; interrupted pushes; full /tmp on the rancher pod.","solutions":["Pull the layer and verify locally: helm show chart on the extracted tar","Re-package with helm package and re-push with helm push","Check disk space for the temp files (os.CreateTemp target)","If digestFile failed, check filesystem health of the rancher pod"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// validate the tar locally before it enters the index\nif _, err := loader.Load(chartTarPath); err != nil {\n\treturn fmt.Errorf(\"not a valid helm chart archive: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n\tif strings.Contains(err.Error(), \"failed to load the chart\") {\n\t\t// the downloaded layer is not a chart tarball: re-push with helm package/push\n\t} else {\n\t\treturn err\n\t}\n}","preventionTips":["Package charts with helm package, never raw tar","Verify chart archives in CI with helm lint / helm show chart","Watch /tmp disk space where chart tars are staged"],"tags":["oci","helm","tarball","chart-loader"],"backgroundTag":null,"analyzedSha":"932558d4e68565aff2d2f36e89ec4a391b06e7c5","analyzedAt":"2026-08-16T04:37:02.125Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}