Tencent/WeKnora · error
join request not found
Error message
join request not found
What it means
ErrJoinRequestNotFound is declared in both the service and repository layers (same message). The repository version is returned when a lookup maps gorm.ErrRecordNotFound to it; the service version is returned by lookups and by ReviewJoinRequest when the request's OrganizationID does not match the caller-supplied orgID. Callers should match with errors.Is.
Source
Thrown at internal/application/service/organization.go:623
return true
}
return org.OwnerTenantID == tenantID
}
// generateInviteCode generates a random 16-character invite code
func generateInviteCode() string {
bytes := make([]byte, 8)
_, _ = rand.Read(bytes)
return hex.EncodeToString(bytes)
}
// ----------------
// Join Requests
// ----------------
var (
ErrPendingRequestExists = errors.New("pending request already exists")
ErrJoinRequestNotFound = errors.New("join request not found")
ErrCannotUpgradeToSameRole = errors.New("cannot request upgrade to same or lower role")
ErrAlreadyAdmin = errors.New("tenant is already an admin")
)
// SubmitJoinRequest submits a request for the caller's tenant to join an organization.
// Dedup is now per-tenant: any user from a tenant already with a pending join
// request is rejected (the same tenant can't queue two simultaneous joins).
func (s *organizationService) SubmitJoinRequest(ctx context.Context, orgID string, userID string, tenantID uint64, message string, requestedRole types.OrgMemberRole) (*types.OrganizationJoinRequest, error) {
logger.Infof(ctx, "Tenant %d (rep user %s) submitting join request for organization %s", tenantID, userID, orgID)
existing, err := s.orgRepo.GetPendingRequestByTenantAndType(ctx, orgID, tenantID, types.JoinRequestTypeJoin)
if err == nil && existing != nil {
return nil, ErrPendingRequestExists
}
org, err := s.orgRepo.GetByID(ctx, orgID)
if err != nil {
if errors.Is(err, repository.ErrOrganizationNotFound) {View on GitHub (pinned to 988cbb0330)
Solutions
- Verify the join request ID and organization ID are correct and belong together.
- Handle errors.Is(err, ErrJoinRequestNotFound) gracefully (e.g. show 'request no longer exists').
- Refresh the request list instead of retrying a cached ID.
Example fix
// before
req, err := svc.ReviewJoinRequest(ctx, orgID, requestID, true)
if err != nil { return err }
// after
req, err := svc.ReviewJoinRequest(ctx, orgID, requestID, true)
if errors.Is(err, organization.ErrJoinRequestNotFound) {
return fmt.Errorf("request %s not found in org %s", requestID, orgID)
} else if err != nil { return err } Defensive patterns
Strategy: try-catch
Try / catch
if errors.Is(err, organization.ErrJoinRequestNotFound) {
http.Error(w, "join request not found", http.StatusNotFound)
return
} Prevention
- Verify org ID and request ID pairing before review calls.
- Refresh stale links/queues after deletions.
- Match with errors.Is since the sentinel exists in both service and repository packages.
When it happens
Trigger: Looking up a join/upgrade request ID that does not exist, querying a pending request when none exists, or calling ReviewJoinRequest with an orgID that differs from the request's actual organization.
Common situations: Stale links after a request was deleted or purged, wrong org ID in admin review flows, cross-tenant ID confusion, or a request ID from another environment.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- member_limit must be >= 0
- pending request already exists
- cannot request upgrade to same or lower role
- tenant is already an admin
- request has already been reviewed
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/67a945c818edc718.
Report an issue: GitHub.