wtfutil/wtf · error
error fetching user: %s
Error message
error fetching user: %s
What it means
Returned by getOtherUserEmail when asana.User.Fetch fails for the given user GID. After passing the empty-uid guard, the library fetches the user to obtain their email; any API error (unknown GID, permissions, network, rate limit) is wrapped with this message.
Source
Thrown at modules/asana/client.go:215
assignee: assignString,
}
return taskItem
}
func getOtherUserEmail(client *asana.Client, uid string) (string, error) {
if uid == "" {
return "", fmt.Errorf("missing uid")
}
u := &asana.User{
ID: uid,
}
err := u.Fetch(client, nil)
if err != nil {
return "", fmt.Errorf("error fetching user: %s", err)
}
return u.Email, nil
}
func getCurrentUserId(client *asana.Client, mode string) (string, error) {
if strings.HasSuffix(mode, "_all") {
return "", nil
}
u, err := client.CurrentUser()
if err != nil {
return "", fmt.Errorf("error getting current user: %s", err)
}
return u.ID, nil
}
func findSection(client *asana.Client, project *asana.Project, sectionName string) (string, error) {View on GitHub (pinned to bb838c1ccb)
Solutions
- Verify the user GID exists and is active: GET /users/<gid> with the same token.
- Handle deactivated/removed users gracefully — treat missing users as an empty email instead of failing the whole fetch.
- Confirm the token's account can see the other user (guest tokens often cannot list workspace members).
- Retry on transient network/5xx errors surfaced in the wrapped message.
Example fix
// before
err := u.Fetch(client, nil)
if err != nil {
return "", fmt.Errorf("error fetching user: %s", err)
}
// after
err := u.Fetch(client, nil)
if err != nil {
return "", fmt.Errorf("error fetching user %s: %w", uid, err)
} Defensive patterns
Strategy: try-catch
Validate before calling
if uid == "" {
return fmt.Errorf("skip: empty user id")
}
// optionally pre-check visibility: GET /users/<gid> succeeds with the same token Type guard
func validUserID(uid string) bool {
return uid != "" && len(uid) >= 5
} Try / catch
email, err := getOtherUserEmail(client, uid)
if err != nil {
log.Printf("could not fetch user %s (may be deactivated or hidden): %v", uid, err)
email = "" // degrade gracefully instead of failing the whole fetch
} Prevention
- Handle deactivated users: old tasks keep assignees who left the workspace.
- Use a full-member token, not a guest token, so other users' profiles are visible.
- Validate user GIDs sourced from task data before fetching.
- Log and skip individual user lookups rather than aborting the entire task fetch.
When it happens
Trigger: Calling getOtherUserEmail with a uid that is not a valid/accessible Asana user GID: user deactivated or removed from the workspace, GID truncated/mistyped, token lacking visibility of that user, or a transient API/network failure during u.Fetch(client, nil).
Common situations: Task assigned to a user who has since left the workspace (deactivated accounts remain on old tasks); malformed uid parsed from task data; token from a guest account that cannot see other members' profiles.
Related errors
- error fetching task: %s
- error getting sections: %s
- error fetching tasks: %s
- error updating task: %s
- missing uid
AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03).
Data as JSON: /api/errors/5afb2956d4c58aa5.
Report an issue: GitHub.