wtfutil/wtf · error

missing uid

Error message

missing uid

What it means

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.

Source

Thrown at modules/asana/client.go:206

	taskItem := &TaskItem{
		name:        task.Name,
		id:          task.ID,
		numSubtasks: task.NumSubtasks,
		dueOn:       dueOnString,
		url:         fmt.Sprintf("https://app.asana.com/0/%s/%s/f", projectId, task.ID),
		taskType:    TASK_TYPE,
		completed:   *task.Completed,
		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
	}

View on GitHub (pinned to bb838c1ccb)

Solutions

  1. Ensure the caller resolves a real user GID before calling getOtherUserEmail (check assignee is set on the task).
  2. Skip email lookup for tasks without an assignee instead of calling with an empty uid.
  3. If uid comes from config/environment, verify it is populated (e.g. non-empty ASANA_USER_ID).

Example fix

// before
email, err := getOtherUserEmail(client, uid)
if err != nil { ... }
// after
if uid == "" {
    return taskItem // skip email lookup for unassigned tasks
}
email, err := getOtherUserEmail(client, uid)
Defensive patterns

Strategy: validation

Validate before calling

if uid == "" {
    // skip email lookup for unassigned tasks
    return taskItem, nil
}
email, err := getOtherUserEmail(client, uid)

Type guard

func hasUID(uid string) bool { return uid != "" }

Try / catch

email, err := getOtherUserEmail(client, uid)
if err != nil {
    if err.Error() == "missing uid" {
        email = "" // task has no assignee; not fatal
    } else {
        return err
    }
}

Prevention

When it happens

Trigger: 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 "".

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03). Data as JSON: /api/errors/8ba9340bffdc1257. Report an issue: GitHub.