{"record":{"id":"a8d0c2fb5db1e06c","repo":"dagger/dagger","slug":"patch-did-not-reproduce-changeset-content-modifie","errorCode":null,"errorMessage":"patch did not reproduce changeset content: modified %v, renamed %v","messagePattern":"patch did not reproduce changeset content: modified (.+?), renamed (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/mcp.go","lineNumber":955,"sourceCode":"\t}\n\tdirChanged := slices.ContainsFunc(\n\t\tslices.Concat(origPaths.Added, origPaths.AllRemoved),\n\t\tfunc(p string) bool { return strings.HasSuffix(p, \"/\") },\n\t)\n\tif !dirChanged {\n\t\treturn patched, nil\n\t}\n\n\tresidual, err := NewChangeset(ctx, patched, changes.Self().After)\n\tif err != nil {\n\t\treturn patched, err\n\t}\n\tpaths, err := residual.ComputePaths(ctx)\n\tif err != nil {\n\t\treturn patched, fmt.Errorf(\"compute patch residue: %w\", err)\n\t}\n\tif len(paths.Modified) > 0 || len(paths.Renamed) > 0 {\n\t\treturn patched, fmt.Errorf(\"patch did not reproduce changeset content: modified %v, renamed %v\", paths.Modified, paths.Renamed)\n\t}\n\tfor _, p := range slices.Concat(paths.Added, paths.AllRemoved) {\n\t\tif !strings.HasSuffix(p, \"/\") {\n\t\t\treturn patched, fmt.Errorf(\"patch did not reproduce changeset file %q\", p)\n\t\t}\n\t}\n\t// Recorded as selectors on the overlay chain, so they are pure data like\n\t// the patch itself, and replay tolerantly: withNewDirectory is mkdir -p,\n\t// withoutDirectory ignores an already-missing path.\n\tfor _, dir := range paths.Added {\n\t\tif err := srv.Select(ctx, patched, &patched, dagql.Selector{\n\t\t\tView:  srv.View,\n\t\t\tField: \"withNewDirectory\",\n\t\t\tArgs: []dagql.NamedInput{\n\t\t\t\t{Name: \"path\", Value: dagql.NewString(strings.TrimSuffix(dir, \"/\"))},\n\t\t\t},\n\t\t}); err != nil {\n\t\t\treturn patched, fmt.Errorf(\"restore directory %q: %w\", dir, err)","sourceCodeStart":937,"sourceCodeEnd":973,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/mcp.go#L937-L973","documentation":"reconcileDirsAfterPatch verification failure: the patched tree still differs from the expected changeset — files remain modified or renamed that the patch should have reproduced. The patch application produced wrong content for regular files.","triggerScenarios":"Thrown at core/mcp.go:955 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Regenerate the patch from the current diff rather than reusing a stale one","Check the patch applies cleanly (context lines, line endings)","Verify the 'after' tree recorded in the changeset matches expectations"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}