{"record":{"id":"861a240aa7bfd337","repo":"helm/helm","slug":"apiversion-is-required-the-value-must-be-v3","errorCode":null,"errorMessage":"apiVersion is required. The value must be \"v3\"","messagePattern":"apiVersion is required\\. The value must be \"v3\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/chart/v3/lint/rules/chartfile.go","lineNumber":128,"sourceCode":"\t\treturn fmt.Errorf(\"failed to strictly parse chart metadata file\\n\\t%w\", chartFileError)\n\t}\n\treturn nil\n}\n\nfunc validateChartName(cf *chart.Metadata) error {\n\tif cf.Name == \"\" {\n\t\treturn errors.New(\"name is required\")\n\t}\n\tname := filepath.Base(cf.Name)\n\tif name != cf.Name {\n\t\treturn fmt.Errorf(\"chart name %q is invalid\", cf.Name)\n\t}\n\treturn nil\n}\n\nfunc validateChartAPIVersion(cf *chart.Metadata) error {\n\tif cf.APIVersion == \"\" {\n\t\treturn errors.New(\"apiVersion is required. The value must be \\\"v3\\\"\")\n\t}\n\n\tif cf.APIVersion != chart.APIVersionV3 {\n\t\treturn fmt.Errorf(\"apiVersion '%s' is not valid. The value must be \\\"v3\\\"\", cf.APIVersion)\n\t}\n\n\treturn nil\n}\n\nfunc validateChartVersion(cf *chart.Metadata) error {\n\tif cf.Version == \"\" {\n\t\treturn errors.New(\"version is required\")\n\t}\n\n\tversion, err := semver.StrictNewVersion(cf.Version)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"version '%s' is not a valid SemVerV2\", cf.Version)\n\t}","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/helm/helm/blob/2a29f1770b62844b27197d2507377361d45ad7c0/internal/chart/v3/lint/rules/chartfile.go#L110-L146","documentation":"Thrown by literalParser.listItem (pkg/strvals/literal_parser.go:216) when parsing the second index of a nested list expression like a[0][1]=v. The inner keyIndex() call fails — typically strconv.Atoi cannot convert the text between '[' and ']' (non-numeric, empty, or containing more delimiters) — and the error is wrapped as 'error parsing index'.","triggerScenarios":"ParseLiteral(\"a[0][x]=1\") — non-numeric nested index. ParseLiteral(\"a[0][]=1\") — empty index Atoi(\"\") fails. ParseLiteral(\"a[0][1.5]=1\") — float index. Unterminated bracket: ParseLiteral(\"a[0][1=1\") reads '1=1' until EOF and Atoi fails.","commonSituations":"Hand-written nested list paths; expecting associative keys inside lists; a missing ']' that shifts what the parser reads as the index.","solutions":["Make every bracketed segment a plain non-negative integer","Ensure each '[' has a matching ']' before the next delimiter","Use dot notation for named sub-keys (a[0].name=x) instead of bracket keys"],"exampleFix":"// before\nstrvals.ParseLiteral(\"matrix[0][row]=1\")\n// after\nstrvals.ParseLiteral(\"matrix[0][0]=1\")","handlingStrategy":"validation","validationCode":"var bracket = regexp.MustCompile(`\\[([^\\]]*)\\]`)\nfunc allIndexesNumeric(s string) bool {\n    for _, m := range bracket.FindAllStringSubmatch(s, -1) {\n        n, err := strconv.Atoi(m[1]); if err != nil || n < 0 { return false }\n    }\n    return true\n}","typeGuard":null,"tryCatchPattern":"if err := strvals.ParseLiteral(s); err != nil && strings.Contains(err.Error(), \"error parsing index\") {\n    return fmt.Errorf(\"nested index in %q must be an integer: %w\", s, err)\n}","preventionTips":["Only integers inside brackets","Match every [ with a ]","Use dot paths for named fields"],"tags":["strvals","set-string","parsing","nested-list","helm"],"backgroundTag":null,"analyzedSha":"2a29f1770b62844b27197d2507377361d45ad7c0","analyzedAt":"2026-08-15T22:02:47.490Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}