# Maximum function nesting level of '256' reached, aborting! while using nested builders

**URL:** <https://forum.getkirby.com/t/maximum-function-nesting-level-of-256-reached-aborting-while-using-nested-builders/19527>\
**Category:** Questions\
**Tags:** v3\
**Created:** [September 26, 2020, 3:43pm UTC](https://forum.getkirby.com/t/maximum-function-nesting-level-of-256-reached-aborting-while-using-nested-builders/19527 "2020-09-26T15:43:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![delphin](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@delphin](https://forum.getkirby.com/u/delphin)\
**Post date:** [September 26, 2020, 3:43pm UTC](https://forum.getkirby.com/t/maximum-function-nesting-level-of-256-reached-aborting-while-using-nested-builders/19527/1 "2020-09-26T15:43:55Z")

</div>

Hi,  
It’s me again.

I’m using the plugin Kirby Builder with nested builders on a page. (I work on Kirby 3.4.2)

Here is my blueprint:

```auto
     - width: 2/3
        fields:
          sectionBuilder:
            label: Services / Formations
            type: builder
            columns: 1
            max: 3
            fieldsets:
              content:
                name: Service / Formation
                fields:
                  contentName:
                    name: Nom
                    label: Nom du service / de la formation
                    type: text
                  contentIcon:
                    name: Icône
                    label: Icône du service / de la formation
                    type: text
                  contentBuilder:
                    name: Contenu
                    type: builder
                    max: 2
                    fieldsets:
                      argumentright:
                        name: Présentation - Image à droite
                        preview:
                          snippet: blocks/argumentright
                          css: /avocatms.fr/assets/css/blocks/argumentright.css
                        defaultView: preview
                        fields:
                          argumentrighttext:
                            label: Texte
                            type: textarea
                            buttons: 
                              - bold
                              - italic
                              - '|'
                              - link
                              - '|'
                              - ol
                              - ul
                          argumentrightimage:
                            label: Image
                            type: files
                            multiple: false
                      argumentleft:
                        name: Présentation - Image à gauche
                        preview:
                          snippet: blocks/argumentleft
                          css: /avocatms.fr/assets/css/blocks/argumentleft.css
                        defaultView: preview
                        fields:
                          argumentlefttext:
                            label: Texte
                            type: textarea
                            buttons: 
                              - bold
                              - italic
                              - '|'
                              - link
                              - '|'
                              - ol
                              - ul
                          argumentleftimage:
                            label: Image
                            type: files
                            multiple: false
                      argumenttextonly:
                        name: Présentation - Aucune image
                        preview:
                          snippet: blocks/argumenttextonly
                          css: /avocatms.fr/assets/css/blocks/argumenttextonly.css
                        defaultView: preview
                        fields:
                          argumenttextonlytext:
                            label: Texte
                            type: textarea
                            buttons: 
                              - bold
                              - italic
                              - '|'
                              - link
                              - '|'
                              - ol
                              - ul

```

I can set my content easily, but I got the error Maximum function nesting level of ‘256’ reached, aborting! with my templates.

I got multiple templates/snippets:

1. The page where i’m calling the first builder

```auto
         ...
        <section class="about py-80" id="about">
                <div class="container">
                    <div class="row">
                        <div class="offset-md-2 col-lg-8">
                            <div class="intro-box">
                                <?= $page->intro()->kt() ?>
                            </div>
                        </div>
                    </div>
                    <?php
                    foreach($page->sectionbuilder()->toBuilderBlocks() as $block):
                    snippet('blocks/' . $block->_key(), array('data' => $block));
                    endforeach;
                    ?>
                    
                </div>
            </section>
           ...

```

1. The first snippet where I’m calling the 2nd builder

```auto
    <section class="services py-100-70">
       <div class="container">
         <div class="row">
             <div class="col-md-8 offset-md-2">
                 <div class="sec-title text-center">
                     <h1>
                         <i class="fal fa-<?= $data->contenticon() ?>"></i>
                     </h1>
                     <h2>
                         <?= $data->contentname() ?>
                     </h2>
                 </div>
             </div>
         </div>
     </div>

     <?php
     foreach($page->sectionbuilder()->contentbuilder()->toBuilderBlocks() as $block):
     snippet('blocks/' . $block->_key(), array('data' => $block));
     endforeach;
     ?>
    </section>

```

1. And then my snippets for my blocks (they are working)

I’m not sure how to fix this, I think it’s creating an endless loop but I have only three blocks on my first builder and two on my second builder.

Thanks

EDIT: i can’t paste the third code, here is a pastebin [Snippet - Pastebin.com](https://pastebin.com/cRXcXf1P)

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 26, 2020, 3:55pm UTC](https://forum.getkirby.com/t/maximum-function-nesting-level-of-256-reached-aborting-while-using-nested-builders/19527/2 "2020-09-26T15:55:09Z")

</div>

The problem is that you are starting at `$page` and the `sectionbuilder` field again. But you have to use your `$data` variable inside the snippet:

```auto
 <?= $data->contentname() ?>
<?php foreach($data->contentbuilder()->toBuilderBlocks() as $block): 
snippet('blocks/' . $block->_key(), array('data' => $block)); 
endforeach; ?> 

```

Please use three backticks on a separate line before and after a codeblock to make your code readable and to enable code highlighting. Thank you.

---

<div class="post-metadata">

**Author:** ![delphin](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@delphin](https://forum.getkirby.com/u/delphin)\
**Post date:** [September 26, 2020, 7:57pm UTC](https://forum.getkirby.com/t/maximum-function-nesting-level-of-256-reached-aborting-while-using-nested-builders/19527/3 "2020-09-26T19:57:32Z")

</div>

Thank you very much it’s working!

(I can’t do backticks with my f\*\* french keyboard)

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 27, 2020, 3:08pm UTC](https://forum.getkirby.com/t/maximum-function-nesting-level-of-256-reached-aborting-while-using-nested-builders/19527/4 "2020-09-27T15:08:44Z")

</div>

> [@delphin](#):
>
> (I can’t do backticks with my f\*\* french keyboard)

What’s your OS? I’m pretty sure there is a way.
