{"record":{"id":"555aed7e249fce0e","repo":"gastownhall/beads","slug":"failed-to-re-import-s-v","errorCode":null,"errorMessage":"Failed to re-import %s: %v","messagePattern":"Failed to re-import (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/tracker/engine.go","lineNumber":1285,"sourceCode":"\t\t\tif c.LocalUpdated.After(c.ExternalUpdated) {\n\t\t\t\tforceIDs[c.IssueID] = true\n\t\t\t\te.msg(\"Conflict on %s: local is newer, pushing\", c.IssueID)\n\t\t\t} else {\n\t\t\t\tskipIDs[c.IssueID] = true\n\t\t\t\tallowPullOverwriteIDs[c.IssueID] = true\n\t\t\t\te.msg(\"Conflict on %s: external is newer, importing\", c.IssueID)\n\t\t\t}\n\t\t}\n\t}\n}\n\n// reimportIssue fetches an external version and reapplies its scalar fields.\n// It deliberately preserves local labels because conflict reimport has no\n// authoritative label collection to synchronize.\nfunc (e *Engine) reimportIssue(ctx context.Context, c Conflict) {\n\textIssue, err := e.Tracker.FetchIssue(ctx, c.ExternalIdentifier)\n\tif err != nil || extIssue == nil {\n\t\te.warn(\"Failed to re-import %s: %v\", c.IssueID, err)\n\t\treturn\n\t}\n\n\tconv := e.Tracker.FieldMapper().IssueToBeads(extIssue)\n\tif conv == nil || conv.Issue == nil {\n\t\treturn\n\t}\n\n\tupdates := map[string]interface{}{\n\t\t\"title\":       conv.Issue.Title,\n\t\t\"description\": conv.Issue.Description,\n\t\t\"priority\":    conv.Issue.Priority,\n\t\t\"status\":      string(conv.Issue.Status),\n\t}\n\tif extIssue.Metadata != nil {\n\t\tif raw, err := json.Marshal(extIssue.Metadata); err == nil {\n\t\t\tupdates[\"metadata\"] = json.RawMessage(raw)\n\t\t}","sourceCodeStart":1267,"sourceCodeEnd":1303,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/tracker/engine.go#L1267-L1303","documentation":"During conflict resolution with re-import (external wins), the engine failed to fetch the external version of the conflicted issue via Tracker.FetchIssue. The local issue keeps its current state and the external changes are not applied. Note the warning also fires when the fetch succeeds but returns nil (issue not found).","triggerScenarios":"e.Tracker.FetchIssue(ctx, c.ExternalIdentifier) returns an error or a nil issue while reimporting a conflict — network failure, 404 for a deleted remote issue, invalid external identifier, or API auth failure.","commonSituations":"Remote issue deleted while a local edit was in flight; network outage or DNS failure during sync; external_ref points at an issue in a project the token can't read; tracker API temporarily down (5xx).","solutions":["Check the wrapped error: 404 means the remote issue is gone — decide whether to delete locally or re-create remotely.","Fix network/auth issues and re-run `bd sync`; conflicts will be recomputed.","Verify the external_ref format is valid for the configured tracker.","If the remote was deleted intentionally, delete the local issue (`bd delete <id>`).","Retry later on transient 5xx/rate-limit responses."],"exampleFix":"// before: remote issue deleted, reimport keeps failing\n// decision: keep local copy without the stale link\nbd update bd-42 --external-ref=\"\"\nbd sync","handlingStrategy":"retry","validationCode":"// verify the external identifier is fetchable before conflict reimport\nif _, err := tracker.FetchIssue(ctx, c.ExternalIdentifier); err != nil {\n    log.Printf(\"pre-check failed for %s: %v\", c.IssueID, err)\n}","typeGuard":null,"tryCatchPattern":"// retry network-shaped failures before giving up on reimport\nfor i := 0; i < 3; i++ {\n    stats, err := engine.Sync(ctx, opts)\n    if err == nil { break }\n    if isNetErr(err) || isRateLimitedErr(err) { time.Sleep(backoff(i)); continue }\n    break\n}","preventionTips":["Resolve conflicts soon after they appear (don't let refs go stale)","Confirm read access to every project referenced by external_refs","Check connectivity/API status before scheduled syncs","Treat persistent 404s as deleted-remote and clean up the local copy"],"tags":["sync","conflict","network","tracker-api"],"backgroundTag":"remote-issue-fetch-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}