goharbor/harbor · error

cannot parse string value

Error message

cannot parse string value(%v) to int64

What it means

Validation in CfgManager.ValidateCfg for StoragePerProject: the value string could not be parsed as an int64, so the storage-per-project quota is not a valid number.

Solutions

  1. Set storage_per_project to a decimal integer byte count or -1 for unlimited
  2. Remove units, decimals or whitespace from the value
  3. Re-apply the configuration once corrected
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/pkg/config/manager.go:215 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/3695973e05627eda. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/config/manager.go:215

			return fmt.Errorf("system config items cannot be updated, item: %v", key)
		}

		strVal := utils.GetStrValueOfAnyType(value)

		// Trim spaces from the robot_name_prefix before validation
		if key == common.RobotNamePrefix {
			strVal = strings.TrimSpace(strVal)
			if len(strVal) == 0 {
				return fmt.Errorf("robot_name_prefix cannot be empty or contain only spaces")
			}
			cfgs[key] = strVal
		}

		// check storage per project before setting it
		if key == common.StoragePerProject {
			storagePerProject, err := strconv.ParseInt(strVal, 10, 64)
			if err != nil {
				return fmt.Errorf("cannot parse string value(%v) to int64", strVal)
			}

			if err := lib.ValidateQuotaLimit(storagePerProject); err != nil {
				return err
			}
		}

		_, err := metadata.NewCfgValue(key, strVal)
		if err != nil {
			return errors.Wrap(err, "item name "+key)
		}
	}

	for _, r := range validateRules {
		if err := r.Validate(ctx, c, cfgs); err != nil {
			return err
		}
	}

View on GitHub (pinned to 7b2fd08cc5)