helm/helm · error

%s should be of type string but it's of type %s

Error message

%s should be of type string but it's of type %s

What it means

Lint rule (helm lint / rules.Chartfile) reporting that the appVersion field in Chart.yaml parsed to a non-string Go type. loadChartFileForTypeCheck reads Chart.yaml into map[string]any, and isStringValue requires the appVersion value to unmarshal to a Go string; e.g. `appVersion: 1.2` becomes float64 and fails with type float64.

Source

Thrown at pkg/chart/v2/lint/rules/chartfile.go:88

	linter.RunLinterRule(support.WarningSev, chartFileName, validateChartVersionStrictSemVerV2(chartFile))
}

func validateChartVersionType(data map[string]any) error {
	return isStringValue(data, "version")
}

func validateChartAppVersionType(data map[string]any) error {
	return isStringValue(data, "appVersion")
}

func isStringValue(data map[string]any, key string) error {
	value, ok := data[key]
	if !ok {
		return nil
	}
	valueType := fmt.Sprintf("%T", value)
	if valueType != "string" {
		return fmt.Errorf("%s should be of type string but it's of type %s", key, valueType)
	}
	return nil
}

func validateChartYamlNotDirectory(chartPath string) error {
	fi, err := os.Stat(chartPath)

	if err == nil && fi.IsDir() {
		return errors.New("should be a file, not a directory")
	}
	return nil
}

func validateChartYamlFormat(chartFileError error) error {
	if chartFileError != nil {
		return fmt.Errorf("unable to parse YAML\n\t%w", chartFileError)
	}
	return nil

View on GitHub (pinned to 2a29f1770b)

Solutions

  1. Quote the value in Chart.yaml: appVersion: "1.16.0".
  2. Quote the version field too (same check applies to version via validateChartVersionType).
  3. Run `helm lint` locally before pushing; CI lint steps catch this cheaply.

Example fix

# before
apiVersion: v2
name: mychart
version: 1.0.0        # also fails the version type check
appVersion: 1.16      # -> appVersion should be of type string but it's of type float64

# after
apiVersion: v2
name: mychart
version: "1.0.0"
appVersion: "1.16"
Defensive patterns

Strategy: validation

Validate before calling

// Go: assert appVersion/version are strings in Chart.yaml before packaging
var m map[string]any
b, _ := os.ReadFile("Chart.yaml")
_ = yaml.Unmarshal(b, &m)
for _, k := range []string{"version", "appVersion"} {
	if v, ok := m[k]; ok && fmt.Sprintf("%T", v) != "string" {
		return fmt.Errorf("%s must be a quoted string", k)
	}
}

Prevention

When it happens

Trigger: Chart.yaml containing `appVersion: 1.16` (unquoted semantic version) or `appVersion: true`; the value must be written as `appVersion: "1.16"`. Reported at ErrorSev, so it fails lint.

Common situations: Authors writing YAML scalars without quotes; copy-paste from Kubernetes manifests where numbers are fine; migration from older charts where quoting was not enforced.

Related errors


AI-assisted analysis of helm/helm@2a29f1770b (2026-08-15). Data as JSON: /api/errors/3c37c507a99109d2. Report an issue: GitHub.