theonedev/onedev · error · ClientException

Chart name or version not specified

Error message

Chart name or version not specified

What it means

HelmPackHandler extracts Chart.yaml from the uploaded chart archive, parses it with SnakeYAML, and rejects the publish with HTTP 400 when either the name or the version field is missing from the chart metadata — both are required keys for a Helm chart.

Source

Thrown at server-plugin/server-plugin-pack-helm/src/main/java/io/onedev/server/plugin/pack/helm/HelmPackHandler.java:215

                        is.read(content);
                        var options = new LoaderOptions();
                        metadata = new Yaml(new SafeConstructor(options)).load(new ByteArrayInputStream(content));
                        break;
                    }
                }                
            } catch (IOException e) {
                throw new ClientException(SC_BAD_REQUEST, "Error reading chart archive: " + e.getMessage());
            }

            if (metadata == null) {
                throw new ClientException(SC_BAD_REQUEST, "Chart.yaml not found in the archive");
            }
            
            var chartName = (String) metadata.get("name");
            var chartVersion = (String) metadata.get("version");
            
            if (chartName == null || chartVersion == null) {
                throw new ClientException(SC_BAD_REQUEST, "Chart name or version not specified");
            }            

            var finalMetadata = metadata;
			var lockName = "update-pack:" + projectId + ":" + HelmPackSupport.TYPE + ":" + chartName + ":" + chartVersion;
            LockUtils.run(lockName, () -> transactionService.run(() -> {
                var project = projectService.load(projectId);

                PackBlob packBlob = packBlobService.load(packBlobService.uploadBlob(projectId, bytes, null));
                var data = new HelmData(finalMetadata, packBlob.getSha256Hash());
                Pack pack = packService.findByNameAndVersion(project, HelmPackSupport.TYPE, chartName, chartVersion);
                if (pack == null) {
                    pack = new Pack();
                    pack.setProject(project);
                    pack.setType(HelmPackSupport.TYPE);
                    pack.setName(chartName);
                    pack.setVersion(chartVersion);
                }
                pack.setData(data);

View on GitHub (pinned to d44925c47c)

Solutions

  1. Add both 'name' and 'version' fields to Chart.yaml and quote the version (e.g. version: "1.0.0")
  2. Re-run 'helm package' after fixing Chart.yaml and re-upload
  3. Validate with 'helm lint' before publishing
  4. Check Chart.yaml for typos in the field names

Example fix

// before (Chart.yaml)
apiVersion: v2
nam: mychart
// after
apiVersion: v2
name: mychart
version: "1.0.0"
Defensive patterns

Strategy: validation

Validate before calling

var yaml = new Yaml(new SafeConstructor(new LoaderOptions()));
Map<String, Object> meta = yaml.load(chartYamlContent);
if (!(meta.get("name") instanceof String name) || name.isBlank())
    throw new IllegalArgumentException("Chart.yaml: missing 'name'");
if (!(meta.get("version") instanceof String version) || version.isBlank())
    throw new IllegalArgumentException("Chart.yaml: missing 'version'");

Type guard

boolean valid = meta instanceof Map m && m.get("name") instanceof String && m.get("version") instanceof String;

Try / catch

try { publish(chart); } catch (ClientException e) { if (e.getMessage().contains("name or version not specified")) repairChartYaml(chart); }

Prevention

When it happens

Trigger: POST/PUT of a chart whose Chart.yaml lacks 'name:' or 'version:' fields, or where those fields are null/non-string so metadata.get returns null.

Common situations: Hand-edited Chart.yaml with deleted/typo'd fields ('nam:' instead of 'name:'), charts scaffolded incompletely, or version fields expressed in a form YAML SafeConstructor does not coerce to String (e.g. version: 1.10 parsed as string here only if quoted).

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/72383baa971fc056. Report an issue: GitHub.