Tencent/WeKnora · error
user not found
Error message
user not found
What it means
Sentinel ErrUserNotFound returned by user repository lookups (by id or email) when GORM reports gorm.ErrRecordNotFound — no user row matches. Mapped from the driver error so callers can distinguish missing records from real DB failures.
Source
Thrown at internal/application/repository/user.go:14
package repository
import (
"context"
"errors"
"github.com/Tencent/WeKnora/internal/types"
"github.com/Tencent/WeKnora/internal/types/interfaces"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
var (
ErrUserNotFound = errors.New("user not found")
ErrUserAlreadyExists = errors.New("user already exists")
ErrTokenNotFound = errors.New("token not found")
ErrCannotRevokeSelf = errors.New("cannot revoke your own system admin privileges")
ErrLastSystemAdmin = errors.New("cannot revoke the last remaining system administrator")
ErrUserNotSystemAdmin = errors.New("user is not a system administrator")
)
// userRepository implements user repository interface
type userRepository struct {
db *gorm.DB
}
// NewUserRepository creates a new user repository
func NewUserRepository(db *gorm.DB) interfaces.UserRepository {
return &userRepository{db: db}
}
// CreateUser creates a userView on GitHub (pinned to 988cbb0330)
Solutions
- Verify the user id/email; the account may have been deleted or the id mistyped
- Return 404 to the client or prompt registration instead of retrying
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at internal/application/repository/user.go:14 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/4b6ada761f122018.
Report an issue: GitHub.