goharbor/harbor · error

%s: %v

Error message

%s: %v

What it means

Legacy legacy-API error wrapper in BaseAPI.ParseAndHandleError: if the error is a *commonhttp.Error it renders the known code/message, otherwise it wraps ANY unknown error as '<text>: %v' and returns HTTP 500. It is a generic catch-all — the message carries the caller's context label plus the underlying error.

Solutions

  1. Inspect the prefixed text and wrapped error to find the failing operation
  2. Upgrade callers to return harbor lib/errors so proper status codes are sent
  3. Fix the underlying operation named by the <text> prefix
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/common/api/base.go:205 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/5cd683cab1b7f555. Report an issue: GitHub.

Appendix: source

Thrown at src/common/api/base.go:205

func (b *BaseAPI) ParseAndHandleError(text string, err error) {
	if err == nil {
		return
	}
	if e, ok := err.(*commonhttp.Error); ok {
		b.RenderError(e.Code, fmt.Sprintf("%s: %s", text, e.Message))
		return
	}
	b.SendInternalServerError(fmt.Errorf("%s: %v", text, err))
}

View on GitHub (pinned to 7b2fd08cc5)