gastownhall/beads · warning

Failed to fetch ADO #%d for link sync: %v

Error message

Failed to fetch ADO #%d for link sync: %v

What it means

This warning (not a returned error) is emitted by pushADOLinks during `bd ado` sync when FetchWorkItems fails or returns no items for a work item that has links to sync. The link sync for that item is skipped (continue) and the failure is surfaced via the warn callback so the rest of the sync proceeds.

Source

Thrown at cmd/bd/ado.go:847

				continue
			}
			desired = append(desired, tracker.DependencyInfo{
				FromExternalID: extIDStr,
				ToExternalID:   targetExtID,
				Type:           string(dep.DependencyType),
			})
		}

		if len(desired) == 0 {
			continue
		}

		// Fetch current ADO work item to get existing relations.
		adoClient := at.ADOClient()
		items, ferr := adoClient.FetchWorkItems(ctx, []int{workItemID})
		if ferr != nil || len(items) == 0 {
			if warn != nil {
				warn(fmt.Sprintf("Failed to fetch ADO #%d for link sync: %v", workItemID, ferr))
			}
			continue
		}

		errs := resolver.PushLinks(ctx, workItemID, items[0].Relations, desired, managedTargets)
		for _, e := range errs {
			msg := fmt.Sprintf("Link sync ADO #%d: %v", workItemID, e)
			warnings = append(warnings, msg)
			if warn != nil {
				warn(msg)
			}
		}
		linkCount += len(desired) - len(errs)
	}

	return linkCount, warnings
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the underlying %v detail (auth error, 404, timeout) and fix that root cause.
  2. Verify the ADO PAT/token is valid and has work-item read scope.
  3. Check the work item still exists in ADO; if deleted, clean up the stale link in beads and re-sync.
  4. Re-run `bd ado sync` after connectivity is restored to retry the skipped item.
Defensive patterns

Strategy: retry

Try / catch

if len(warnings) > 0 {
	for _, w := range warnings {
		if strings.Contains(w, "Failed to fetch ADO") {
			// retry sync after checking token/connectivity
		}
	}
}

Prevention

When it happens

Trigger: ADO API outage/auth failure during FetchWorkItems; the work item was deleted in Azure DevOps after beads cached its ID; a network timeout or rate limit mid-sync; items returned empty for an ID that no longer exists.

Common situations: Expired or rotated PAT credentials; deleted ADO work items still linked in beads; corporate proxy/firewall blocking dev.azure.com; transient ADO service throttling during large syncs.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/d85c8124ca899279. Report an issue: GitHub.