goharbor/harbor · error

system config items cannot be updated, item

Error message

system config items cannot be updated, item: %v

What it means

ValidateCfg refused the update because the named configuration item is marked SystemScope — user-level (non-admin-deploy) configuration changes cannot modify system-scoped items, which are fixed at deploy time.

Solutions

  1. Remove the system-scoped item from the API configuration update
  2. Change the value in harbor.yml and restart/reconfigure the deployment if it truly must change
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/pkg/config/manager.go:197 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/5ca192fe30f0d30b. Report an issue: GitHub.

Appendix: source

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

// UpdateConfig - Update config Store with a specified configuration and also save updated configure.
func (c *CfgManager) UpdateConfig(ctx context.Context, cfgs map[string]any) error {
	return c.Store.Update(ctx, cfgs)
}

// GetItemFromDriver ...
func (c *CfgManager) GetItemFromDriver(ctx context.Context, key string) (map[string]any, error) {
	return c.Store.GetFromDriver(ctx, key)
}

// 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)

View on GitHub (pinned to 7b2fd08cc5)