{"record":{"id":"83648ac6b171473e","repo":"theonedev/onedev","slug":"chart-yaml-not-found-in-the-archive","errorCode":null,"errorMessage":"Chart.yaml not found in the archive","messagePattern":"Chart\\.yaml not found in the archive","errorType":"http","errorClass":"ClientException","httpStatus":400,"severity":"error","filePath":"server-plugin/server-plugin-pack-helm/src/main/java/io/onedev/server/plugin/pack/helm/HelmPackHandler.java","lineNumber":208,"sourceCode":"                TarEntry entry;\n                while ((entry = is.getNextEntry()) != null) {\n                    String entryName = entry.getName();\n                    if (entryName.equals(\"Chart.yaml\") || entryName.endsWith(\"/Chart.yaml\")) {\n                        if (entry.getSize() > MAX_FILE_SIZE)\n                            throw new ClientException(SC_BAD_REQUEST, \"Chart.yaml is too large\");\n                        byte[] content = new byte[(int) entry.getSize()];\n                        is.read(content);\n                        var options = new LoaderOptions();\n                        metadata = new Yaml(new SafeConstructor(options)).load(new ByteArrayInputStream(content));\n                        break;\n                    }\n                }                \n            } catch (IOException e) {\n                throw new ClientException(SC_BAD_REQUEST, \"Error reading chart archive: \" + e.getMessage());\n            }\n\n            if (metadata == null) {\n                throw new ClientException(SC_BAD_REQUEST, \"Chart.yaml not found in the archive\");\n            }\n            \n            var chartName = (String) metadata.get(\"name\");\n            var chartVersion = (String) metadata.get(\"version\");\n            \n            if (chartName == null || chartVersion == null) {\n                throw new ClientException(SC_BAD_REQUEST, \"Chart name or version not specified\");\n            }            \n\n            var finalMetadata = metadata;\n\t\t\tvar lockName = \"update-pack:\" + projectId + \":\" + HelmPackSupport.TYPE + \":\" + chartName + \":\" + chartVersion;\n            LockUtils.run(lockName, () -> transactionService.run(() -> {\n                var project = projectService.load(projectId);\n\n                PackBlob packBlob = packBlobService.load(packBlobService.uploadBlob(projectId, bytes, null));\n                var data = new HelmData(finalMetadata, packBlob.getSha256Hash());\n                Pack pack = packService.findByNameAndVersion(project, HelmPackSupport.TYPE, chartName, chartVersion);\n                if (pack == null) {","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-pack-helm/src/main/java/io/onedev/server/plugin/pack/helm/HelmPackHandler.java#L190-L226","documentation":"Thrown when the chart archive was read successfully but no entry named Chart.yaml (at archive root) was found, leaving metadata null. OneDev requires Chart.yaml to extract the chart name and version, so a chart without it is rejected with 400 Bad Request.","triggerScenarios":"POST/PUT of a .tgz whose entries do not include a root-level Chart.yaml — e.g. the tgz wraps a directory differently, Chart.yaml is missing/renamed, or the archive contains only templates/.","commonSituations":"Hand-rolled tar files, charts created without 'helm package', archives where Chart.yaml sits under an extra top-level directory after manual zipping, or uploading a Helm-provenance (.prov) or OCI blob by mistake.","solutions":["Run 'helm package <chart-dir>' so Chart.yaml is included at the archive root","Confirm 'tar tzf chart.tgz' lists Chart.yaml at the root of the archive","If Chart.yaml is nested under a folder, restructure/repackage so it is at the top level","Ensure you are uploading the chart tgz, not a .prov file or other artifact"],"exampleFix":"// before (manual archive missing Chart.yaml)\ntar czf mychart.tgz templates/ values.yaml\n// after\nhelm package mychart  # includes Chart.yaml at root","handlingStrategy":"validation","validationCode":"boolean hasChartYaml = false;\ntry (var tar = new TarArchiveInputStream(new GzipCompressorInputStream(new FileInputStream(tgz)))) {\n    TarArchiveEntry e;\n    while ((e = tar.getNextTarEntry()) != null)\n        if (!e.isDirectory() && e.getName().replaceFirst(\"^[^/]+/\", \"\").equals(\"Chart.yaml\")) { hasChartYaml = true; break; }\n}\nif (!hasChartYaml) throw new IllegalArgumentException(\"archive must contain Chart.yaml\");","typeGuard":null,"tryCatchPattern":"try { publish(chart); } catch (ClientException e) { if (e.getMessage().contains(\"Chart.yaml not found\")) fixAndRepackage(chart); }","preventionTips":["Use 'helm package' exclusively to build chart archives","Run 'helm lint' before publishing","Never strip Chart.yaml from archives"],"tags":["helm","chart-yaml","archive","validation"],"backgroundTag":"file-not-found","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}