wtfutil/wtf · error
could not get builds: %w
Error message
could not get builds: %w
What it means
Wraps an error from the Azure DevOps Build API GetBuilds call in getBuildStats: the widget could not retrieve the build list for the configured project. Fires on network failures, invalid PAT token, wrong organization/project name, or API errors.
Source
Thrown at modules/azuredevops/client.go:16
package azuredevops
import (
"fmt"
"strings"
azrBuild "github.com/microsoft/azure-devops-go-api/azuredevops/build"
)
func (widget *Widget) getBuildStats() string {
projName := widget.settings.projectName
statusFilter := azrBuild.BuildStatusValues.All
top := widget.settings.maxRows
builds, err := widget.cli.GetBuilds(widget.ctx, azrBuild.GetBuildsArgs{Project: &projName, StatusFilter: &statusFilter, Top: &top})
if err != nil {
return fmt.Errorf("could not get builds: %w", err).Error()
}
result := ""
for _, build := range builds.Value {
num := *build.BuildNumber
branch := *build.SourceBranch
reason := *build.Reason
triggers := *build.TriggerInfo
if reason == azrBuild.BuildReasonValues.PullRequest {
branch = triggers["pr.sourceBranch"]
}
branch = strings.TrimPrefix(branch, "refs/heads/")
status := *build.Status
statusDisplay := "[white:grey]unknown"
switch status {
case azrBuild.BuildStatusValues.InProgress:
statusDisplay = "[white:blue]in progress"View on GitHub (pinned to bb838c1ccb)
Solutions
- Verify the PAT token (apiToken setting) is valid and has Build read scope
- Check orgURL and projectName settings match the actual Azure DevOps organization/project
- Confirm network access to dev.azure.com including proxy/firewall rules
- Read the wrapped error (%w) for the specific HTTP or authentication failure
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at modules/azuredevops/client.go:16 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03).
Data as JSON: /api/errors/f502143c1f943870.
Report an issue: GitHub.