goharbor/harbor · error
project not found
Error message
project %v not found
What it means
handleProjectNotFound raises this for system-admin callers when the requested project ID/name resolves to no project; regular users instead get a permission error to avoid disclosing project existence.
Solutions
- Verify the project ID or name in the request is correct
- Check whether the project was deleted
- List projects to confirm the exact identifier
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/core/api/base.go:121 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/65dfc7b9226eccd0.
Report an issue: GitHub.
Appendix: source
Thrown at src/core/api/base.go:121
} else {
b.SendError(err)
}
return false
}
if !hasPermission {
b.SendPermissionError()
return false
}
return true
}
// This should be called when a project is not found, if the caller is a system admin it returns 404.
// If it's regular user, it will render permission error
func (b *BaseController) handleProjectNotFound(projectIDOrName any) {
if b.SecurityCtx.IsSysAdmin() {
b.SendNotFoundError(fmt.Errorf("project %v not found", projectIDOrName))
} else {
b.SendPermissionError()
}
}
// SendPermissionError is a shortcut for sending different http error based on authentication status.
func (b *BaseController) SendPermissionError() {
if !b.SecurityCtx.IsAuthenticated() {
b.SendUnAuthorizedError(errors.New("UnAuthorized"))
} else {
b.SendForbiddenError(errors.New(b.SecurityCtx.GetUsername()))
}
}
// WriteJSONData writes the JSON data to the client.
func (b *BaseController) WriteJSONData(object any) {
b.Data["json"] = object
if err := b.ServeJSON(); err != nil {View on GitHub (pinned to 7b2fd08cc5)