# Depth limit writing content with a/b tests

**URL:** <https://forum.builder.io/t/depth-limit-writing-content-with-a-b-tests/15739>\
**Category:** Bugs\
**Created:** [September 5, 2025, 3:31pm UTC](https://forum.builder.io/t/depth-limit-writing-content-with-a-b-tests/15739 "2025-09-05T15:31:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jchisholm](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jchisholm](https://forum.builder.io/u/jchisholm)\
**Post date:** [September 5, 2025, 3:31pm UTC](https://forum.builder.io/t/depth-limit-writing-content-with-a-b-tests/15739/1 "2025-09-05T15:31:40Z")

</div>

I’m seeing an issue where creating content via the write API with an a/b test variation that has quite a deep structure (more than 20 nodes deep), then I get an HTTP 500 error.

This does not apply to creating content without a/b test variations.

A reproduction of the issue is here:

> **[GitHub - jchisholm-forbesadvisor/builder-io-depth-issue: Demonstrates a limitation of builder.io where a/b...](https://github.com/jchisholm-forbesadvisor/builder-io-depth-issue)**
>
> Demonstrates a limitation of builder.io where a/b test variations have a depth limit

Is this a bug or a known limitation? Any ideas how I can work around this issue?

Thanks!

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [September 8, 2025, 9:31am UTC](https://forum.builder.io/t/depth-limit-writing-content-with-a-b-tests/15739/2 "2025-09-08T09:31:22Z")

</div>

Hello @jchisholm

Thank you for sharing such a clear reproduction of the issue. This is very helpful.

We’ll review this in detail on my end, try to reproduce the behavior, and discuss it further with our internal team. As you mentioned, the issue doesn’t seem to affect non-A/B test content.

We really appreciate your patience and the thorough report—it makes troubleshooting much easier.

Thanks,

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [September 8, 2025, 6:35pm UTC](https://forum.builder.io/t/depth-limit-writing-content-with-a-b-tests/15739/3 "2025-09-08T18:35:02Z")

</div>

Hello @jchisholm

The error you’re seeing isn’t a bug in the Write API itself but rather a [limitation of Firestore](https://firebase.google.com/docs/firestore/quotas#collections_documents_and_fields), which enforces a maximum nesting depth of **20 levels** per document. When an A/B test variation includes blocks nested more deeply than that, Firestore rejects the payload and the request fails with an HTTP 500.

To work around this limitation, we recommend using **[symbols](https://www.builder.io/c/docs/integrate-symbols)** and **references** instead of embedding extremely deep structures directly within the variation. This approach allows you to:

- **Break down complex hierarchies** into smaller, reusable content entries.

- **Reference those entries** inside your variation rather than nesting all elements inline.

- **Stay well within Firestore’s depth limit** while still preserving the ntended structure.

This pattern also makes your content more modular and easier to manage across multiple variations.

Let us know if you have any further questions.

Thanks,

---

<div class="post-metadata">

**Author:** ![jchisholm](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jchisholm](https://forum.builder.io/u/jchisholm)\
**Post date:** [October 6, 2025, 8:58am UTC](https://forum.builder.io/t/depth-limit-writing-content-with-a-b-tests/15739/4 "2025-10-06T08:58:35Z")

</div>

Hi,

Thanks for your suggestion.

I understand your suggestion about using symbols to work around this issue, but I’m not sure how we might ensure that advice was followed in practice to prevent our content editors from violating it.

I am trying to use the API to build A/B test variations. I have [created](https://builder.io/content/359ea49a8f994b0c9f3cd42f67ac5990_1852e2269f0c4176be3cac77fd8f99d9) an A/B test variation in the browser that violates this maximum depth issue. How is it possible for me to do that in the web interface but not via the API?

Thanks,

Josh

---

<div class="post-metadata">

**Author:** ![jchisholm](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jchisholm](https://forum.builder.io/u/jchisholm)\
**Post date:** [October 10, 2025, 2:08pm UTC](https://forum.builder.io/t/depth-limit-writing-content-with-a-b-tests/15739/5 "2025-10-10T14:08:52Z")

</div>

Hi @manish-sharma,

This really does seem like a bug in the Write API because:

- it’s possible to save documents that exceed the depth limit via the web interface, but not via the API. You can see an example of an a/b test variation that has depth 25 (which is impossible to save via the write API) that was created via the web interface here: [builder-io-depth-issue/deep-nesting-in-variation-created-in-web-ui.json at main · jchisholm-forbesadvisor/builder-io-depth-issue · GitHub](https://github.com/jchisholm-forbesadvisor/builder-io-depth-issue/blob/main/deep-nesting-in-variation-created-in-web-ui.json)

- The write API should not fail with an HTTP 500 status or expose the fact that firestore is used internally.

Any further comments?

Thanks again,

Josh
