SOLVED: Extract-component-from-elements always fails with bricks_conflict_extract_component_consistency_recovered

Browser: Chrome 152
OS: macOS

I build pages programmatically through the 2.4 abilities and then want to turn repeated blocks — cards, list items, testimonial boxes — into components, so that whoever takes over the site can edit them in one place. bricks/extract-component-from-elements is exactly the ability for that, but I can’t get a single successful call out of it.

Environment: Bricks 2.4-rc2, WordPress 7.1, PHP 8.3.30, through the Abilities API. Reproduced as a non-admin account holding bricks_full_access, which has all 390 builder permissions including create_components and insert_components.

The error, every time:

bricks_conflict_extract_component_consistency_recovered
The page committed, but the exact inserted component was not authoritative afterward.
Both writes were safely compensated; re-read before retrying.

To reproduce, on a fresh published page with Bricks editor mode, write a simple tree through bricks/set-page-elements:

[
 {"id":"secfff","name":"section","parent":0,"children":["kartya"],"settings":{}},
 {"id":"kartya","name":"block","parent":"secfff","children":["khed01","ktxt01"],
  "settings":{"_padding":{"top":"24"}}},
 {"id":"khed01","name":"heading","parent":"kartya","children":[],
  "settings":{"text":"Egy","tag":"h3"}},
 {"id":"ktxt01","name":"text-basic","parent":"kartya","children":[],"settings":{"text":"a"}}
]

then call:

bricks/extract-component-from-elements
{ "postId": <page id>, "rootElementId": "kartya", "label": "Extracted card" }

Afterwards: zero components in bricks_components, the page still has its original four elements, no element carries a cid, and the frontend renders unchanged. So the compensation genuinely is safe — nothing is corrupted — but the operation never completes.

I tried the thing the error suggests. Re-reading the page elements and retrying, three times in a row, gives the identical error each time. It isn’t a transient conflict.

I also tried it against a tree produced by bricks/commit-html-css-page-import rather than a hand-written one, in case the source mattered. Same result.

Worth saying that the rest of the component surface works fine, so this looks specific to the extract path. bricks/create-component with an inline element array succeeds, and placing instances works too — an element with the component root’s own element name plus a cid validates through set-page-elements and renders correctly on the frontend. So I have a workaround: build the component definition separately and place instances by hand. It’s just considerably more work than extracting from what’s already on the page, which is the natural way round when you’ve just imported a design.

Thanks for the detailed report. We were able to reproduce this issue, including the rollback that leaves the original page elements intact.

We’ve addressed this in Bricks 2.4.2, now available as a one-click update in your WordPress Dashboard.

Please read the changelog entry before updating, and let us know if you experience any issues.