goharbor/harbor · error · errors.Error

BAD_REQUEST

BAD_REQUEST

Error message

err.Error()

What it means

Error "err.Error()" thrown in goharbor/harbor.

Source

Thrown at src/server/v2.0/handler/registry.go:59

type registryAPI struct {
	BaseAPI
	ctl registry.Controller
}

func (r *registryAPI) CreateRegistry(ctx context.Context, params operation.CreateRegistryParams) middleware.Responder {
	if err := r.RequireSystemAccess(ctx, rbac.ActionCreate, rbac.ResourceRegistry); err != nil {
		return r.SendError(ctx, err)
	}
	registry := &model.Registry{
		Name:        params.Registry.Name,
		Description: params.Registry.Description,
		Type:        params.Registry.Type,
		URL:         params.Registry.URL,
		Insecure:    params.Registry.Insecure,
	}
	if params.Registry.CaCertificate != nil {
		if err := commonhttp.ValidateCACertificate(*params.Registry.CaCertificate); err != nil {
			return r.SendError(ctx, errors.New(nil).WithCode(errors.BadRequestCode).WithMessage(err.Error()))
		}
		registry.CACertificate = *params.Registry.CaCertificate
	}
	if params.Registry.Credential != nil {
		registry.Credential = &model.Credential{
			Type:         params.Registry.Credential.Type,
			AccessKey:    params.Registry.Credential.AccessKey,
			AccessSecret: params.Registry.Credential.AccessSecret,
		}
	}

	id, err := r.ctl.Create(ctx, registry)
	if err != nil {
		return r.SendError(ctx, err)
	}
	location := fmt.Sprintf("%s/%d", strings.TrimSuffix(params.HTTPRequest.URL.Path, "/"), id)
	return operation.NewCreateRegistryCreated().WithLocation(location)
}

View on GitHub (pinned to 7b2fd08cc5)

When it happens

Trigger: Thrown at src/server/v2.0/handler/registry.go:59 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/5752bed910736c32. Report an issue: GitHub.