gotify/server · error
user with id %d not found
Error message
user with id %d not found
What it means
InitializeForUserID looks up the user by ID and, when the storage returns no user (nil) and no error, returns 'user with id %d not found'. It guards the per-user plugin initialization against stale or invalid user IDs.
Source
Thrown at plugin/manager.go:270
return fmt.Errorf("plugin with module path %s is present at least twice", modulePath)
}
m.plugins[modulePath] = compatPlugin
return nil
}
// InitializeForUserID initializes all plugin instances for a given user.
func (m *Manager) InitializeForUserID(userID uint) error {
m.mutex.Lock()
defer m.mutex.Unlock()
user, err := m.db.GetUserByID(userID)
if err != nil {
return err
}
if user != nil {
return m.initializeForUser(*user)
}
return fmt.Errorf("user with id %d not found", userID)
}
func (m *Manager) initializeForUser(user model.User) error {
userCtx := compat.UserContext{
ID: user.ID,
Name: user.Name,
Admin: user.Admin,
}
for _, p := range m.plugins {
if err := m.initializeSingleUserPlugin(userCtx, p); err != nil {
return err
}
}
apps, err := m.db.GetApplicationsByUser(user.ID)
if err != nil {
return errView on GitHub (pinned to 14bfc25627)
Solutions
- Verify the user ID exists before calling InitializeForUserID
- Handle the error by skipping plugin initialization for the missing user
- Clean up plugin enable/disable config entries when deleting users
Defensive patterns
Strategy: try-catch
Validate before calling
u, err := userStorage.GetUserByID(userID)
if err != nil || u == nil {
log.Printf("user %d does not exist; skipping plugin init", userID)
return
} Try / catch
if err := mgr.InitializeForUserID(uid); err != nil {
if strings.Contains(err.Error(), "not found") {
log.Printf("stale user id %d, skipping", uid)
return nil
}
return err
} Prevention
- Delete plugin config entries when removing users
- Re-check user existence before deferred initialization tasks
- Use foreign keys/cascades between users and plugin settings
When it happens
Trigger: Calling InitializeForUserID with a userID that does not exist in the user storage — typically a deleted user, or a user ID from a stale session/token.
Common situations: Race where a user is deleted while their plugin sessions are being initialized, or tests/bots passing synthetic user IDs.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- plugin does not support %s
- NewGotifyPluginInstance signature mismatch, func(ctx plugin.
- unknown plugin version (unrecogninzed GetGotifyPluginInfo si
- error while reading directory %s
- plugin with module path %s is present at least twice
AI-assisted analysis of gotify/server@14bfc25627 (2026-09-05).
Data as JSON: /api/errors/bce084aedcaf24b0.
Report an issue: GitHub.