# DuplicateException when creating a page programmaticaly (Kirby version \> 3.8.1)

**URL:** https://forum.getkirby.com/t/duplicateexception-when-creating-a-page-programmaticaly-kirby-version-3-8-1/27385
**Category:** Questions
**Tags:** v3
**Created:** [December 27, 2022, 4:08am UTC](https://forum.getkirby.com/t/duplicateexception-when-creating-a-page-programmaticaly-kirby-version-3-8-1/27385 "2022-12-27T04:08:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![gillesvauvarin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/gillesvauvarin/32/2351_2.png) [@gillesvauvarin](https://forum.getkirby.com/u/gillesvauvarin)
#### Post date: [December 27, 2022, 4:08am UTC](https://forum.getkirby.com/t/duplicateexception-when-creating-a-page-programmaticaly-kirby-version-3-8-1/27385/1 "2022-12-27T04:08:17Z")

</div>

I have a weird bug that appears with Kirby 3.8.2 when the UUID generation is not disabled.

It happens when I try to create a page programmatically. Kirby creates the page but throws an exception:

```auto
"Kirby \ Exception \ DuplicateException (error.page.draft.duplicate)" 
.../kirby/src/Cms/PageRules.php269 

```

The draft page created has only the uuid wrote in the txt file not the title.  
My website is multilingual (I don’t know if this influences the bug)

What’s weird is that it only happens with one of my templates, not the others.

The bug happens with this simple code:

```auto
$kirby->impersonate('kirby');
$data = [
    'title' => 'My title',
];
$kirby->site()->createChild([
    'content' => $data,
    'slug' => Str::slug( $data['title'] ),
    'template' => 'adventurer',
]);

```

If I change `'template' => 'adventurer',` by another template, it works! (uuid enabled)  
If I keep `'template' => 'adventurer',` but disable UUID, it works! (whatever Kirby version)  
If I keep `'template' => 'adventurer',` and use a Kirby version \< 3.8.2, it works! (uuid enabled)

So it may have something to do with a change in the UUID handling in Kirby 3.8.2. But what I don’t understand is why this bug only occurs when I create a page with one type of template and not the others?

---

<div class="post-metadata">

### Author: ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)
#### Post date: [December 27, 2022, 7:25am UTC](https://forum.getkirby.com/t/duplicateexception-when-creating-a-page-programmaticaly-kirby-version-3-8-1/27385/2 "2022-12-27T07:25:43Z")

</div>

This is known issue as [[Panel, Multilang] Add page Dialog throws false duplicate error when page.uuid method is present in blueprint · Issue #4955 · getkirby/kirby · GitHub](https://github.com/getkirby/kirby/issues/4955) and will be fixed asap. You can downgrade to 3.8.1 as workaround.

---

<div class="post-metadata">

### Author: ![gillesvauvarin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/gillesvauvarin/32/2351_2.png) [@gillesvauvarin](https://forum.getkirby.com/u/gillesvauvarin)
#### Post date: [December 28, 2022, 2:21am UTC](https://forum.getkirby.com/t/duplicateexception-when-creating-a-page-programmaticaly-kirby-version-3-8-1/27385/3 "2022-12-28T02:21:07Z")

</div>

Ok, thanks for this information 🙂 I will downgrade to 3.8.1 until the bug is fixed.
