{"record":{"id":"3225b474e2f7cbd0","repo":"gitbutlerapp/gitbutler","slug":"unable-to-determine-target-commit-for-unassigned-c","errorCode":null,"errorMessage":"Unable to determine target commit for unassigned change: {}","messagePattern":"Unable to determine target commit for unassigned change: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/legacy/absorb.rs","lineNumber":483,"sourceCode":"        // If the first stack has no commits, create a blank commit first\n        commit_insert_blank_only_impl(\n            ctx,\n            RelativeTo::Reference(reference),\n            InsertSide::Below,\n            DryRun::No,\n            perm,\n        )?;\n\n        // Now project the workspace again to see the newly created commit\n        *workspace = crate::legacy::workspace::head_info(ctx)?;\n        if let (_, Some(commit_id)) = target_segment(workspace, stack_id, None)? {\n            return Ok((stack_id, commit_id, AbsorptionReason::DefaultStack));\n        }\n\n        anyhow::bail!(\"Failed to create blank commit in leftmost stack\");\n    }\n\n    anyhow::bail!(\n        \"Unable to determine target commit for unassigned change: {}\",\n        candidate.hunk.path\n    );\n}\n\n/// Prepare commit absorptions with commit summaries\n///\n/// This returns a vector of absorption information, sorted and ready for processing.\nfn prepare_commit_absorptions(\n    ctx: &Context,\n    changes_by_commit: GroupedChanges,\n) -> anyhow::Result<Vec<CommitAbsorption>> {\n    let mut commit_absorptions = Vec::new();\n\n    // The workspace projection carries every stack's segments and commits in order\n    let workspace = crate::legacy::workspace::head_info(ctx)?;\n    let all_stack_ids = changes_by_commit\n        .keys()","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/legacy/absorb.rs#L465-L501","documentation":"When absorbing an unassigned change, the code must determine which commit the change belongs to. If no candidate stack/commit could be resolved for the hunk's path — neither via assignment rules nor the default (leftmost) stack — this error is thrown with the offending file path. It means absorb cannot place the change anywhere.","triggerScenarios":"Calling absorb with an unassigned change whose path cannot be matched to any stack, and ensure_target_commit also failed to produce a default target commit.","commonSituations":"Absorbing hunks in a workspace with no stacks at all; path matching rules out every stack; a corrupted or freshly-initialized workspace without a default stack.","solutions":["Create at least one stack (commit) in the workspace before absorbing","Assign the file to a stack via workspace assignment rules","Verify the workspace is correctly initialized (but workspace status)","Move the change manually with git instead of absorb"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const stacks = await getWorkspaceStacks(projectId);\nif (!stacks.length) throw new Error('No stacks: cannot absorb');","typeGuard":null,"tryCatchPattern":"try {\n  await absorbChanges(projectId, changes);\n} catch (e) {\n  if (String(e).startsWith('Unable to determine target commit')) {\n    // surface which file path was unplaceable to the user\n    showToast(`Cannot place change: ${e.message}`);\n  } else throw e;\n}","preventionTips":["Create a commit/stack before absorbing unassigned changes","Assign files to stacks with assignment rules","Check that the changed paths match an existing stack"],"tags":["rust","workspace","absorb"],"backgroundTag":"resource-not-found","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}