{"record":{"id":"31c1fe85780c7c1f","repo":"wtfutil/wtf","slug":"error-getting-sections-s","errorCode":null,"errorMessage":"error getting sections: %s","messagePattern":"error getting sections: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/asana/client.go","lineNumber":240,"sourceCode":"\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\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif sectionId == \"\" {\n\t\treturn \"\", fmt.Errorf(\"we didn't find the section %s\", sectionName)\n\t}\n\n\treturn sectionId, nil\n}\n\nfunc getTasksFromAsana(client *asana.Client, q *asana.TaskQuery) ([]*asana.Task, bool, error) {\n\tmoreTasks := false","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/asana/client.go#L222-L258","documentation":"Returned by findSection when project.Sections fails to list the sections of the target project. The helper needs the full section list to match a section by name; an API error here (bad project GID, permissions, rate limit, network) aborts the section resolution and propagates up to fetchTasksFromProjectSections.","triggerScenarios":"Calling fetchTasksFromProjectSections where project.Sections(client, &asana.Options{Limit:100}) errors: project GID nonexistent/archived/deleted, token lacks access to the project, Asana 429 rate limiting, or network failure.","commonSituations":"Project GID copied from a URL of a different workspace; project archived after config was written; token is a guest with no project access; hitting rate limits when many projects' sections are enumerated in one run.","solutions":["Verify the project GID: GET /projects/<gid> with the token; expect 200 and the right project name.","Confirm the token can list the project's sections: GET /projects/<gid>/sections.","Check for 429 in the wrapped error and add backoff/retry; the Limit:100 request is repeated per section, amplifying rate usage.","If the project is archived/deleted, update the config with the current project GID."],"exampleFix":"// before\nsections, _, err := project.Sections(client, &asana.Options{Limit: 100})\nif err != nil {\n    return \"\", fmt.Errorf(\"error getting sections: %s\", err)\n}\n// after\nsections, _, err := project.Sections(client, &asana.Options{Limit: 100})\nif err != nil {\n    return \"\", fmt.Errorf(\"error getting sections for project %s: %w\", project.ID, err)\n}","handlingStrategy":"validation","validationCode":"p, _, err := client.GetProjectByID(projectGID)\nif err != nil {\n    return fmt.Errorf(\"project %s not accessible: %w\", projectGID, err)\n}\nif _, _, err := p.Sections(client, &asana.Options{Limit: 1}); err != nil {\n    return fmt.Errorf(\"cannot list sections of %s: %w\", projectGID, err)\n}","typeGuard":null,"tryCatchPattern":"tasks, err := mod.Fetch(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"error getting sections\") {\n        log.Printf(\"project %s unreachable (check GID, archive status, token): %v\", projectGID, err)\n        return nil\n    }\n    return err\n}","preventionTips":["Validate the project GID at startup with GET /projects/<gid>.","Watch for 429s when enumerating sections across many projects; add backoff.","Confirm the project is not archived/deleted when configs go stale.","Use a token with explicit access to the project's workspace/team."],"tags":["asana","api","sections","project","error-wrapping"],"backgroundTag":"api-request-failed","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"}