goharbor/harbor · error

invalid int string

Error message

invalid int string: %s

What it means

parseInt could not interpret the input as a 32-bit int: base-10 parsing failed and the float fallback either failed or yielded a fractional value; the offending string is included. Reached from IntType/PortType validate and get.

Solutions

  1. Supply a plain decimal integer string within 32-bit range
  2. Remove whitespace, units or formatting from the value
  3. Ensure the value does not exceed the int32 range when parsed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/config/metadata/type.go:278 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16). Data as JSON: /api/errors/fa88ebd33cdbd667. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/config/metadata/type.go:278

	if err == nil && fval == math.Trunc(fval) {
		return int64(fval), nil
	}

	return 0, fmt.Errorf("invalid int64 string: %s", str)
}

func parseInt(str string) (int, error) {
	val, err := strconv.ParseInt(str, 10, 32)
	if err == nil {
		return int(val), nil
	}

	fval, err := strconv.ParseFloat(str, 32)
	if err == nil && fval == math.Trunc(fval) {
		return int(fval), nil
	}

	return 0, fmt.Errorf("invalid int string: %s", str)
}

func parseFloat64(str string) (float64, error) {
	val, err := strconv.ParseFloat(str, 64)
	if err == nil {
		return val, nil
	}

	return 0, fmt.Errorf("invalid float64 string: %s", str)
}

View on GitHub (pinned to 7b2fd08cc5)