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

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:

"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:

$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?

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 and will be fixed asap. You can downgrade to 3.8.1 as workaround.

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