wtfutil/wtf · error
error getting current user: %s
Error message
error getting current user: %s
What it means
Returned by getCurrentUserId when client.CurrentUser() fails. This helper resolves the authenticated user's GID (skipped when mode ends in '_all'); a failure means the token could not be validated against the Asana API, so all task-fetch modes that need the current user abort with this error.
Source
Thrown at modules/asana/client.go:227
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) {
sectionId := ""
sections, _, err := project.Sections(client, &asana.Options{
Limit: 100,
})
if err != nil {
return "", fmt.Errorf("error getting sections: %s", err)
}
for _, section := range sections {
if section.Name == sectionName {
sectionId = section.IDView on GitHub (pinned to bb838c1ccb)
Solutions
- Check the token is set and valid: curl -H 'Authorization: Bearer <token>' https://app.asana.com/api/1.0/users/me.
- Regenerate the PAT in Asana developer console if it was revoked, and update the environment.
- Use a mode ending in '_all' if you don't need per-user filtering (getCurrentUserId then short-circuits and never calls the API).
- Verify network/proxy connectivity to app.asana.com from your environment.
Example fix
// before
u, err := client.CurrentUser()
if err != nil {
return "", fmt.Errorf("error getting current user: %s", err)
}
// after
u, err := client.CurrentUser()
if err != nil {
return "", fmt.Errorf("error getting current user (check ASANA_TOKEN): %w", err)
} Defensive patterns
Strategy: validation
Validate before calling
token := os.Getenv("ASANA_TOKEN")
if token == "" {
return fmt.Errorf("ASANA_TOKEN is not set")
}
client := asana.NewClientWithAccessToken(token)
if _, err := client.CurrentUser(); err != nil {
return fmt.Errorf("ASANA_TOKEN invalid or revoked: %w", err)
} Try / catch
tasks, err := mod.Fetch(ctx)
if err != nil {
if strings.Contains(err.Error(), "error getting current user") {
return fmt.Errorf("authentication failed: verify ASANA_TOKEN: %w", err)
}
return err
} Prevention
- Check ASANA_TOKEN is set and non-empty before starting the app.
- Regenerate revoked PATs from the Asana developer console and update secrets.
- Verify connectivity to app.asana.com from your environment/CI.
- Use a '_all' mode suffix when current-user resolution is unnecessary.
When it happens
Trigger: Any Fetch call (project, project-sections, or workspace mode with a non-'_all' mode) where client.CurrentUser() errors: missing/empty or revoked token, malformed Authorization header, Asana outage, or network failure.
Common situations: ASANA_TOKEN unset or set to an empty string in the environment; PAT revoked from Asana developer console; clock/network issues in CI; token belonging to a deactivated account.
Related errors
- error fetching tasks: %s
- error fetching task: %s
- error updating task: %s
- missing uid
- error fetching user: %s
AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03).
Data as JSON: /api/errors/1b382b62833bac4f.
Report an issue: GitHub.