wtfutil/wtf · error

error fetching tasks: %s

Error message

error fetching tasks: %s

What it means

The Asana module's fetchTasksFromProject calls getTasksFromAsana (the go-asana client's task query). If that API call returns an error, it is wrapped with fmt.Errorf("error fetching tasks: %s", err), preserving the underlying cause (auth failure, bad project ID, network error) while labeling it as a task-fetch failure.

Source

Thrown at modules/asana/client.go:28

func fetchTasksFromProject(token, projectId, mode string) ([]*TaskItem, error) {
	taskItems := []*TaskItem{}
	uidToName := make(map[string]string)

	client := asana.NewClientWithAccessToken(token)

	uid, err := getCurrentUserId(client, mode)
	if err != nil {
		return nil, err
	}

	q := &asana.TaskQuery{
		Project: projectId,
	}

	fetchedTasks, _, err := getTasksFromAsana(client, q)
	if err != nil {
		return nil, fmt.Errorf("error fetching tasks: %s", err)
	}

	processFetchedTasks(client, &fetchedTasks, &taskItems, &uidToName, mode, projectId, uid)

	return taskItems, nil
}

func fetchTasksFromProjectSections(token, projectId string, sections []string, mode string) ([]*TaskItem, error) {
	taskItems := []*TaskItem{}
	uidToName := make(map[string]string)

	client := asana.NewClientWithAccessToken(token)

	uid, err := getCurrentUserId(client, mode)
	if err != nil {
		return nil, err
	}

View on GitHub (pinned to bb838c1ccb)

Solutions

  1. Read the wrapped %s cause in the error text to identify the root failure.
  2. Verify the Asana personal access token is valid and has access to the target project/workspace.
  3. Confirm the projectId in the module settings matches a real project the token can read.
  4. Check network connectivity to app.asana.com/api and retry; if rate-limited, back off and reduce poll frequency.

Example fix

// before: error fetching tasks: asana: not found (wrong projectId)
asana:
  apiKey: "1/1234:abcdef"
  project: "9999999999999"  # nonexistent

// after
asana:
  apiKey: "1/1234:abcdef"   # valid PAT
  project: "1201234567890123"  # correct project GID
Defensive patterns

Strategy: retry

Validate before calling

if apiKey == "" || projectID == "" {
    return errors.New("asana apiKey and projectId must be configured")
}

Try / catch

tasks, err := fetchTasksFromProject(client, projectId, mode, uid)
if err != nil {
    var asanaErr *asana.ErrorResponse
    if errors.As(err, &asanaErr) {
        log.Printf("asana API error: %v", asanaErr)
    }
    // retry with backoff for transient/network errors
}

Prevention

When it happens

Trigger: Fetch -> fetchTasksFromProject: getTasksFromAsana(client, &asana.TaskQuery{Project: projectId}) returns a non-nil error — invalid or expired Asana personal access token, nonexistent/inaccessible project ID, network failure, or Asana API rate limiting.

Common situations: Wrong or revoked Asana PAT in module settings; projectId typo'd or the token's user lacks access to the workspace/project; offline/laptop asleep; hitting Asana API rate limits.

Related errors


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