goharbor/harbor · error

invalid int64 string

Error message

invalid int64 string: %s

What it means

parseInt64 could not interpret the input string as an int64: strict base-10 parsing failed and the scientific-notation fallback either failed to parse as a float or produced a non-integral value; the offending string is echoed. It surfaces from QuotaType/Int64Type validate and get calls.

Solutions

  1. Provide a decimal integer string such as '1024' or a scientific form with an integral result like '1e3'
  2. Trim whitespace and remove units/suffixes before passing the value
  3. Validate user input as numeric before it reaches the config layer
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/config/metadata/type.go:264 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/d219eaa11334d6a7. Report an issue: GitHub.

Appendix: source

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

func (t *DurationType) get(str string) (any, error) {
	// should not parse the duration to avoid duplicate parse.
	return str, nil
}

// parseInt64 returns int64 from string which support scientific notation
func parseInt64(str string) (int64, error) {
	val, err := strconv.ParseInt(str, 10, 64)
	if err == nil {
		return val, nil
	}

	fval, err := strconv.ParseFloat(str, 64)
	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)

View on GitHub (pinned to 7b2fd08cc5)