{"record":{"id":"5b48f3dd3fe193a2","repo":"gastownhall/beads","slug":"invalid-ado-configuration-w","errorCode":null,"errorMessage":"invalid ADO configuration: %w","messagePattern":"invalid ADO configuration: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/ado.go","lineNumber":436,"sourceCode":"\tevt := metrics.NewCommandEvent(\"ado-projects\")\n\tdefer func() {\n\t\tif c := metrics.Global(); c != nil {\n\t\t\tc.CloseEventAndAdd(evt)\n\t\t}\n\t}()\n\n\tcfg := getADOConfig()\n\tif cfg.PAT == \"\" {\n\t\treturn fmt.Errorf(\"ado.pat not configured: set via 'bd config set ado.pat <token>' or AZURE_DEVOPS_PAT env var\")\n\t}\n\tif cfg.Org == \"\" && cfg.URL == \"\" {\n\t\treturn fmt.Errorf(\"ado.org not configured: set via 'bd config set ado.org <org>' or AZURE_DEVOPS_ORG env var\")\n\t}\n\n\tout := cmd.OutOrStdout()\n\tclient, err := getADOClient(cfg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid ADO configuration: %w\", err)\n\t}\n\tctx := context.Background()\n\n\tprojects, err := client.ListProjects(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to list projects: %w\", err)\n\t}\n\n\tif jsonOutput {\n\t\treturn outputJSON(projects)\n\t}\n\n\t_, _ = fmt.Fprintln(out, \"Azure DevOps Projects\")\n\t_, _ = fmt.Fprintln(out, \"=====================\")\n\tfor _, p := range projects {\n\t\t_, _ = fmt.Fprintf(out, \"  %s\\n\", p.Name)\n\t\tif p.Description != \"\" {\n\t\t\t_, _ = fmt.Fprintf(out, \"    %s\\n\", p.Description)","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/ado.go#L418-L454","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nado:\n  url: \"https:/dev.azure.com/mycompany\"  # malformed\n\n// after\n$ bd config set ado.url https://dev.azure.com/mycompany","handlingStrategy":"validation","validationCode":"u, err := url.Parse(adoURL)\nif err != nil || u.Scheme == \"\" || u.Host == \"\" {\n\treturn fmt.Errorf(\"ado.url invalid: %q\", adoURL)\n}\nif pat != \"\" && strings.TrimSpace(pat) != pat {\n\treturn fmt.Errorf(\"ado.pat has surrounding whitespace\")\n}","typeGuard":"func isValidADOURL(s string) bool {\n\tu, err := url.Parse(s)\n\treturn err == nil && (u.Scheme == \"http\" || u.Scheme == \"https\") && u.Host != \"\"\n}","tryCatchPattern":"if err := runADOProjects(cmd, args); err != nil {\n\tvar cfgErr *fmt.Errorf\n\tif errors.As(err, &cfgErr) && strings.Contains(err.Error(), \"invalid ADO configuration\") {\n\t\tlog.Fatalf(\"fix ado config: %v\", err) // cause is wrapped via %w\n\t}\n}","preventionTips":["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."],"tags":["azure-devops","configuration","client-initialization","invalid-config"],"backgroundTag":"invalid-configuration","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}