goharbor/harbor · error

accessory type not support

Error message

accessory type %s not support

What it means

Accessory.New looked up an accessory factory for the requested type in the global registry and found none, meaning no provider registered itself for that type string (e.g. via an init-time Register call) before New was invoked.

Solutions

  1. Verify the accessory type string matches a registered factory exactly
  2. Ensure the provider package that calls Register for this type is imported/initialized
  3. Register a custom factory before calling accessory.New
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/pkg/accessory/model/accessory.go:138 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/99820aaaea7b1ccb. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/accessory/model/accessory.go:138

	lock      sync.RWMutex
)

// Register accessory factory for type
func Register(typ string, factory NewAccessoryFunc) {
	lock.Lock()
	defer lock.Unlock()

	factories[typ] = factory
}

// New returns accessory instance
func New(typ string, data AccessoryData) (Accessory, error) {
	lock.Lock()
	defer lock.Unlock()

	factory, ok := factories[typ]
	if !ok {
		return nil, fmt.Errorf("accessory type %s not support", typ)
	}

	data.Type = typ
	return factory(data), nil
}

// ToAccessory converts json object to Accessory
func ToAccessory(acc []byte) (Accessory, error) {
	var data AccessoryData
	if err := json.Unmarshal(acc, &data); err != nil {
		return nil, err
	}
	factory, ok := factories[data.Type]
	if !ok {
		return nil, errors.Errorf("accessory type %s not support", data.Type)
	}
	return factory(data), nil
}

View on GitHub (pinned to 7b2fd08cc5)