{"record":{"id":"1b382b62833bac4f","repo":"wtfutil/wtf","slug":"error-getting-current-user-s","errorCode":null,"errorMessage":"error getting current user: %s","messagePattern":"error getting current user: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/asana/client.go","lineNumber":227,"sourceCode":"\tu := &asana.User{\n\t\tID: uid,\n\t}\n\n\terr := u.Fetch(client, nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error fetching user: %s\", err)\n\t}\n\n\treturn u.Email, nil\n}\n\nfunc getCurrentUserId(client *asana.Client, mode string) (string, error) {\n\tif strings.HasSuffix(mode, \"_all\") {\n\t\treturn \"\", nil\n\t}\n\tu, err := client.CurrentUser()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error getting current user: %s\", err)\n\t}\n\n\treturn u.ID, nil\n}\n\nfunc findSection(client *asana.Client, project *asana.Project, sectionName string) (string, error) {\n\tsectionId := \"\"\n\n\tsections, _, err := project.Sections(client, &asana.Options{\n\t\tLimit: 100,\n\t})\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error getting sections: %s\", err)\n\t}\n\n\tfor _, section := range sections {\n\t\tif section.Name == sectionName {\n\t\t\tsectionId = section.ID","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/asana/client.go#L209-L245","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nu, err := client.CurrentUser()\nif err != nil {\n    return \"\", fmt.Errorf(\"error getting current user: %s\", err)\n}\n// after\nu, err := client.CurrentUser()\nif err != nil {\n    return \"\", fmt.Errorf(\"error getting current user (check ASANA_TOKEN): %w\", err)\n}","handlingStrategy":"validation","validationCode":"token := os.Getenv(\"ASANA_TOKEN\")\nif token == \"\" {\n    return fmt.Errorf(\"ASANA_TOKEN is not set\")\n}\nclient := asana.NewClientWithAccessToken(token)\nif _, err := client.CurrentUser(); err != nil {\n    return fmt.Errorf(\"ASANA_TOKEN invalid or revoked: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"tasks, err := mod.Fetch(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"error getting current user\") {\n        return fmt.Errorf(\"authentication failed: verify ASANA_TOKEN: %w\", err)\n    }\n    return err\n}","preventionTips":["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."],"tags":["asana","auth","token","current-user"],"backgroundTag":"invalid-api-token","analyzedSha":"bb838c1ccb0f0f3223690df44afdec663d622881","analyzedAt":"2026-09-03T17:02:45.030Z","contentChangedAt":"2026-09-03T17:02:45.030Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}