gastownhall/beads · error
invalid ADO configuration: %w
Error message
invalid ADO configuration: %w
What it means
Wraps any error returned by getADOClient(cfg) when constructing the Azure DevOps client for `bd ado projects`. It means the combination of org/URL/PAT settings present is syntactically or semantically invalid (e.g. malformed URL, bad credential encoding), distinct from the earlier 'not configured' checks. The %w chain preserves the underlying cause for inspection.
Source
Thrown at cmd/bd/ado.go:436
evt := metrics.NewCommandEvent("ado-projects")
defer func() {
if c := metrics.Global(); c != nil {
c.CloseEventAndAdd(evt)
}
}()
cfg := getADOConfig()
if cfg.PAT == "" {
return fmt.Errorf("ado.pat not configured: set via 'bd config set ado.pat <token>' or AZURE_DEVOPS_PAT env var")
}
if cfg.Org == "" && cfg.URL == "" {
return fmt.Errorf("ado.org not configured: set via 'bd config set ado.org <org>' or AZURE_DEVOPS_ORG env var")
}
out := cmd.OutOrStdout()
client, err := getADOClient(cfg)
if err != nil {
return fmt.Errorf("invalid ADO configuration: %w", err)
}
ctx := context.Background()
projects, err := client.ListProjects(ctx)
if err != nil {
return fmt.Errorf("failed to list projects: %w", err)
}
if jsonOutput {
return outputJSON(projects)
}
_, _ = fmt.Fprintln(out, "Azure DevOps Projects")
_, _ = fmt.Fprintln(out, "=====================")
for _, p := range projects {
_, _ = fmt.Fprintf(out, " %s\n", p.Name)
if p.Description != "" {
_, _ = fmt.Fprintf(out, " %s\n", p.Description)View on GitHub (pinned to 71377f2769)
Solutions
- Read the wrapped cause after 'invalid ADO configuration:' — it names the exact field that failed.
- Fix the offending value: `bd config set ado.url https://dev.azure.com/<org>` or re-set the PAT via ado.pat / AZURE_DEVOPS_PAT.
- Sanitize the PAT: re-copy it without whitespace/newlines.
- If a URL override is set but you intend default Azure DevOps hosting, clear it and rely on ado.org only.
- Re-run `bd ado projects` to confirm.
Example fix
// before ado: url: "https:/dev.azure.com/mycompany" # malformed // after $ bd config set ado.url https://dev.azure.com/mycompany
Defensive patterns
Strategy: validation
Validate before calling
u, err := url.Parse(adoURL)
if err != nil || u.Scheme == "" || u.Host == "" {
return fmt.Errorf("ado.url invalid: %q", adoURL)
}
if pat != "" && strings.TrimSpace(pat) != pat {
return fmt.Errorf("ado.pat has surrounding whitespace")
} Type guard
func isValidADOURL(s string) bool {
u, err := url.Parse(s)
return err == nil && (u.Scheme == "http" || u.Scheme == "https") && u.Host != ""
} Try / catch
if err := runADOProjects(cmd, args); err != nil {
var cfgErr *fmt.Errorf
if errors.As(err, &cfgErr) && strings.Contains(err.Error(), "invalid ADO configuration") {
log.Fatalf("fix ado config: %v", err) // cause is wrapped via %w
}
} Prevention
- Always set URLs via `bd config set`, never hand-edit config files.
- Paste PATs without quotes/newlines; validate with a quick curl to the org URL.
- Pin a team config template and lint it in CI.
When it happens
Trigger: getADOClient returns a non-nil error: typically a malformed ado.url/ado.baseurl value, an invalid PAT format, or an unsupported proxy/client option derived from the stored config.
Common situations: Hand-edited .beads/config or bd config values containing typos (e.g. 'https:/dev.azure.com'), a PAT pasted with surrounding whitespace or invalid base64, or a config written by an older bd version with fields the client builder rejects.
Related errors
- no known transition path from %q to %q for %s: %w
- Azure DevOps PAT not configured (set ado.pat or AZURE_DEVOPS
- multiple .doltcfg directories detected
- dolt directory is required
- httpapi: a configured role fires this workspace's hooks; thi
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/5b48f3dd3fe193a2.
Report an issue: GitHub.