goharbor/harbor · error

invalid config, item not defined in metadatalist

Error message

invalid config, item not defined in metadatalist, %v

What it means

Validation in CfgManager.ValidateCfg: a configuration key in the submitted map has no corresponding item in the metadata list, so it is not a known/defined system config and the update is rejected.

Solutions

  1. Remove or correct the misspelled key in the configuration update payload
  2. Check the metadata list (metadatalist.go) for the exact item name
  3. Register the new item in metadata if it is a legitimate new setting
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/pkg/config/manager.go:194 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/97ee1aff5139da70. Report an issue: GitHub.

Appendix: source

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

	}
}

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

View on GitHub (pinned to 7b2fd08cc5)