goharbor/harbor · error

robot_name_prefix cannot be empty or contain only spaces

Error message

robot_name_prefix cannot be empty or contain only spaces

What it means

Error "robot_name_prefix cannot be empty or contain only spaces" thrown in goharbor/harbor.

Source

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

// ValidateCfg validate config by metadata. return the first error if exist.
func (c *CfgManager) ValidateCfg(ctx context.Context, cfgs map[string]any) error {
	for key, value := range cfgs {
		item, exist := metadata.Instance().GetByName(key)
		if !exist {
			return fmt.Errorf("invalid config, item not defined in metadatalist, %v", key)
		}
		if item.Scope == metadata.SystemScope {
			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 {

View on GitHub (pinned to 7b2fd08cc5)

When it happens

Trigger: Thrown at src/pkg/config/manager.go:206 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/5097a03b0a63b704. Report an issue: GitHub.