{"record":{"id":"85aea4d8c0c7fa77","repo":"gastownhall/beads","slug":"fast-forward-to-s-w","errorCode":null,"errorMessage":"fast-forward to %s: %w","messagePattern":"fast-forward to (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/versioncontrolops/fastforward.go","lineNumber":95,"sourceCode":"\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn false, fmt.Errorf(\"iterate dolt_status: %w\", err)\n\t}\n\n\treturn clean, nil\n}\n\n// FastForwardAdopt fast-forwards the current branch to ref via\n// CALL DOLT_MERGE('--ff-only', ref). ref must already be cached locally\n// (e.g. a remote-tracking ref updated by a prior fetch); this performs no\n// fetch of its own and fails if the merge would not be a pure fast-forward.\nfunc FastForwardAdopt(ctx context.Context, db DBConn, ref string) error {\n\tif err := issueops.ValidateRef(ref); err != nil {\n\t\treturn fmt.Errorf(\"invalid ref: %w\", err)\n\t}\n\n\tif _, err := db.ExecContext(ctx, \"CALL DOLT_MERGE('--ff-only', ?)\", ref); err != nil {\n\t\treturn fmt.Errorf(\"fast-forward to %s: %w\", ref, err)\n\t}\n\treturn nil\n}\n","sourceCodeStart":77,"sourceCodeEnd":99,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/versioncontrolops/fastforward.go#L77-L99","documentation":"FastForwardAdopt executes CALL DOLT_MERGE('--ff-only', ?) after validating the ref. If the merge fails — the ref doesn't exist locally, the merge would not be a pure fast-forward, uncommitted changes block the merge, or a Dolt error occurs — the error is wrapped as \"fast-forward to <ref>: %w\".","triggerScenarios":"Calling FastForwardAdopt with a valid-syntax ref that was never fetched (unknown ref); local branch has commits not on ref (non-fast-forward); dirty working set; detached or unexpected current branch; concurrent Dolt session state conflict.","commonSituations":"Skipping the fetch step the docs require; local work diverged from origin/main so --ff-only refuses; uncommitted dolt_status entries; running against a branch whose upstream was force-pushed and rewrote history.","solutions":["Fetch first (CALL DOLT_FETCH('origin')) — FastForwardAdopt performs no fetch of its own.","Check WorkingSetClean and commit or stash uncommitted changes before the merge.","If the branch has diverged, decide whether to rebase locally or use a non-ff strategy; --ff-only will not overwrite local commits.","Read the wrapped Dolt error message — it names the merge conflict or unknown-ref cause."],"exampleFix":"// before\nversioncontrolops.FastForwardAdopt(ctx, db, \"origin/main\")\n// after\nif err := fetchOrigin(ctx, db); err != nil { return err } // ensure ref is cached\nclean, err := versioncontrolops.WorkingSetClean(ctx, db)\nif err != nil || !clean { return fmt.Errorf(\"working set dirty, aborting ff\") }\nversioncontrolops.FastForwardAdopt(ctx, db, \"origin/main\")","handlingStrategy":"validation","validationCode":"// fetch + preconditions before FastForwardAdopt\nif err := fetchOrigin(ctx, db); err != nil { return err } // CALL DOLT_FETCH('origin')\nclean, err := versioncontrolops.WorkingSetClean(ctx, db)\nif err != nil { return err }\nif !clean { return fmt.Errorf(\"uncommitted changes block --ff-only merge\") }","typeGuard":null,"tryCatchPattern":"err := versioncontrolops.FastForwardAdopt(ctx, db, \"origin/main\")\nif err != nil {\n    if strings.Contains(err.Error(), \"not a fast-forward\") || strings.Contains(err.Error(), \"diverged\") {\n        return fmt.Errorf(\"branch diverged; rebase or merge manually\")\n    }\n    return err\n}","preventionTips":["Always fetch before adopting — FastForwardAdopt does no fetch of its own.","Check WorkingSetClean immediately before the merge.","Treat --ff-only failures as a signal of divergence; never force it.","Be cautious when an upstream was force-pushed — history rewrites always fail here."],"tags":["dolt","merge","fast-forward","git"],"backgroundTag":"fast-forward-merge-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}