{"record":{"id":"8ba9340bffdc1257","repo":"wtfutil/wtf","slug":"missing-uid","errorCode":null,"errorMessage":"missing uid","messagePattern":"missing uid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/asana/client.go","lineNumber":206,"sourceCode":"\n\ttaskItem := &TaskItem{\n\t\tname:        task.Name,\n\t\tid:          task.ID,\n\t\tnumSubtasks: task.NumSubtasks,\n\t\tdueOn:       dueOnString,\n\t\turl:         fmt.Sprintf(\"https://app.asana.com/0/%s/%s/f\", projectId, task.ID),\n\t\ttaskType:    TASK_TYPE,\n\t\tcompleted:   *task.Completed,\n\t\tassignee:    assignString,\n\t}\n\n\treturn taskItem\n\n}\n\nfunc getOtherUserEmail(client *asana.Client, uid string) (string, error) {\n\tif uid == \"\" {\n\t\treturn \"\", fmt.Errorf(\"missing uid\")\n\t}\n\n\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}","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/asana/client.go#L188-L224","documentation":"A guard in getOtherUserEmail that returns this error when called with an empty user ID string. The library needs a valid Asana user GID to fetch the other participant's email; an empty uid means the caller's lookup produced nothing and no API call should be attempted. It is a local validation error, not an API failure.","triggerScenarios":"processFetchedTasks calls getOtherUserEmail with a uid derived from task data (e.g. assignee/followers) that is empty — typically when a task has no assignee or the ID extraction returned \"\".","commonSituations":"Unassigned tasks in the fetched set; tasks whose assignee data was not hydrated by the query fields; workspace-mode runs where uid resolution silently yields an empty string.","solutions":["Ensure the caller resolves a real user GID before calling getOtherUserEmail (check assignee is set on the task).","Skip email lookup for tasks without an assignee instead of calling with an empty uid.","If uid comes from config/environment, verify it is populated (e.g. non-empty ASANA_USER_ID)."],"exampleFix":"// before\nemail, err := getOtherUserEmail(client, uid)\nif err != nil { ... }\n// after\nif uid == \"\" {\n    return taskItem // skip email lookup for unassigned tasks\n}\nemail, err := getOtherUserEmail(client, uid)","handlingStrategy":"validation","validationCode":"if uid == \"\" {\n    // skip email lookup for unassigned tasks\n    return taskItem, nil\n}\nemail, err := getOtherUserEmail(client, uid)","typeGuard":"func hasUID(uid string) bool { return uid != \"\" }","tryCatchPattern":"email, err := getOtherUserEmail(client, uid)\nif err != nil {\n    if err.Error() == \"missing uid\" {\n        email = \"\" // task has no assignee; not fatal\n    } else {\n        return err\n    }\n}","preventionTips":["Check task.Assignee is set before requesting the other user's email.","Provide uid via config/environment and validate it is non-empty at startup.","Treat missing assignee as an expected case, not an error path."],"tags":["asana","validation","missing-argument","user"],"backgroundTag":"missing-required-argument","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"}