{"record":{"id":"0258f6eef7f82d4d","repo":"gastownhall/beads","slug":"initializing-azure-devops-tracker-w","errorCode":null,"errorMessage":"initializing Azure DevOps tracker: %w","messagePattern":"initializing Azure DevOps tracker: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/ado.go","lineNumber":530,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"%w (--prefer-local, --prefer-ado, --prefer-newer)\", err)\n\t}\n\n\tif err := ensureStoreActive(); err != nil {\n\t\treturn fmt.Errorf(\"database not available: %w\", err)\n\t}\n\n\tout := cmd.OutOrStdout()\n\tctx := context.Background()\n\n\t// Create and initialize the ADO tracker\n\tat := &ado.Tracker{}\n\tcliProjects, _ := cmd.Flags().GetStringSlice(\"project\")\n\tif len(cliProjects) > 0 {\n\t\tat.SetProjects(tracker.DeduplicateStrings(cliProjects))\n\t}\n\tif err := at.Init(ctx, store); err != nil {\n\t\treturn fmt.Errorf(\"initializing Azure DevOps tracker: %w\", err)\n\t}\n\n\t// Build pull filters from CLI flags, falling back to config values.\n\tfilters := buildADOPullFilters(ctx, cmd)\n\tif filters != nil {\n\t\tif err := filters.Validate(); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid pull filter: %w\", err)\n\t\t}\n\t\tat.SetFilters(filters)\n\t}\n\n\t// Create the sync engine\n\tengine := tracker.NewEngine(at, store, actor)\n\tvar warnings []string\n\tif !jsonOutput {\n\t\tengine.OnMessage = func(msg string) { _, _ = fmt.Fprintln(out, \"  \"+msg) }\n\t}\n\tengine.OnWarning = func(msg string) {","sourceCodeStart":512,"sourceCodeEnd":548,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/ado.go#L512-L548","documentation":"Wraps a failure from at.Init(ctx, store) when `bd ado sync` constructs and initializes the Azure DevOps tracker (ado.Tracker). Init validates ADO credentials/organization, resolves the project list (CLI --project flags take precedence, deduplicated), and prepares sync metadata against the local store; any failure here is reported with this message and the %w cause.","triggerScenarios":"at.Init returning an error: missing/invalid ADO config at tracker level, unknown --project names not found in the org, store queries failing while loading tracker state, or auth handshake with Azure DevOps failing.","commonSituations":"Misspelled project passed via --project; PAT valid but lacking access to a specific project; tracker metadata in the local store out of sync after a manual .beads edit; org value pointing at an org the PAT cannot read.","solutions":["Read the wrapped cause after 'initializing Azure DevOps tracker:' — it identifies which Init step failed.","Validate project names: `bd ado projects` and only pass names from that list to --project.","Re-check ado.pat/ado.org (or AZURE_DEVOPS_PAT/AZURE_DEVOPS_ORG) values and PAT scope.","If local tracker state is suspect, run `bd doctor` or re-init per the docs before re-syncing.","Retry `bd ado sync` after correcting the config."],"exampleFix":"// before\nbd ado sync --project \"My Proj \"   # trailing space, unknown project\n\n// after\nbd ado projects           # confirm exact names\nbd ado sync --project \"My Project\"","handlingStrategy":"try-catch","validationCode":"names, err := runADOProjects(cmd, nil) // discover valid projects first\nif err != nil { return err }\nfor _, p := range cliProjects {\n\tif !slices.Contains(names, p) {\n\t\treturn fmt.Errorf(\"unknown project %q\", p)\n\t}\n}","typeGuard":"func isTrackerInitError(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"initializing Azure DevOps tracker\")\n}","tryCatchPattern":"if err := bd(\"ado\", \"sync\", args...); err != nil {\n\tif isTrackerInitError(err) {\n\t\tlog.Printf(\"tracker init failed: %v — check ado.pat/ado.org and --project names\", err)\n\t}\n\treturn err\n}","preventionTips":["Pass --project values copied exactly from `bd ado projects` output.","Keep PAT scope sufficient for every referenced project.","Avoid hand-editing tracker metadata in .beads; use bd commands.","Run `bd doctor` after unusual manual changes before syncing."],"tags":["azure-devops","tracker","initialization","sync"],"backgroundTag":"tracker-init-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}