gitbutlerapp/gitbutler · error

The resolution for " " contains a conflict marker ( )

Error message

The resolution for "{path}" contains a conflict marker ({marker:?})

What it means

The user-supplied resolution content still contains a git conflict marker line (e.g. <<<<<<<, =======, >>>>>>>, detected via is_marker_shaped). Committing such content would embed unresolved conflict markers, so the library rejects it upfront. Trailing \r is stripped so CRLF files are still detected.

Solutions

  1. Strip all conflict marker lines (<<<<<<<, =======, >>>>>>>, |||||||) from the resolution content
  2. Edit the file manually to choose actual resolved content between markers
  3. Improve the generating tool/AI prompt to exclude marker lines

Example fix

// before
content: "<<<<<<< HEAD\nfoo\n=======\nbar\n>>>>>>> branch"
// after
content: "bar" // markers removed, one side chosen or merged
Defensive patterns

Strategy: validation

Validate before calling

/^(<{7}|={7}|>{7}|\|{7})/.test(content) && throw new Error('resolution still contains conflict markers');

Try / catch

try { await applyResolution(content); } catch (e) { if (String(e).includes('contains a conflict marker')) { content = stripMarkers(content); await applyResolution(content); } else { throw e; } }

Prevention

When it happens

Trigger: ensure_no_markers (from validate_specs) finds a marker-shaped line in the content of a HunkResolution::Content (or full-file resolution) being applied.

Common situations: Pasting a resolution directly from an editor still showing markers, programmatically extracting hunk content that includes the surrounding marker lines, AI suggestions that copied marker text, or tools that only remove `<<<<<<<` but leave `=======`.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/ce8bbc4724eecbb9. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-api/src/resolve/apply.rs:157

            .is_some()
        {
            bail!(
                "Two conflicted paths normalize to the same value ({:?}); resolve this commit manually instead",
                normalize_path(&file.path)
            );
        }
    }
    Ok(files_by_path)
}

/// Reject content that contains a conflict-marker-shaped line.
pub(crate) fn ensure_no_markers(content: &str, path: &str) -> anyhow::Result<()> {
    if let Some(marker) = content
        .lines()
        .map(|line| line.strip_suffix('\r').unwrap_or(line))
        .find(|line| is_marker_shaped(line))
    {
        bail!("The resolution for \"{path}\" contains a conflict marker ({marker:?})");
    }
    Ok(())
}

/// Normalize a path for comparison: trim, backslashes to slashes, strip a
/// leading `./`, collapse duplicate slashes. Applied to both request and
/// caller-provided paths, so callers matching against [`ConflictedFile`] paths
/// should normalize with this too.
///
/// [`ConflictedFile`]: super::ConflictedFile
pub fn normalize_path(path: &str) -> String {
    let mut normalized = path.trim().replace('\\', "/");
    while normalized.contains("//") {
        normalized = normalized.replace("//", "/");
    }
    normalized
        .strip_prefix("./")
        .map(str::to_owned)

View on GitHub (pinned to 58e5313667)