Uuid in blueprint causes false duplicate page error

When a call to page.uuid is present in a blueprint and a new draft of this specific blueprint is created in the panel, it shows

Error: A page draft with the URL appendix "..." already exists.

But the page is created anyway and shows up in the pages section when refreshing the panel after cancelling the dialog.

I tried a fresh starterkit, but everything works as expected there.

Then I tried to narrow down where the error comes from:

  • disabling all plugins
  • removing all page models
  • creating a page method with a Uuid and an appendix and calling it instead of page.uuid in the template

Nothing worked. The error persists and I donā€™t know where to look further.
I am grateful for any ideas, what I could try next.

Please post the blueprint with this method

And which Kirby version are you using?

sections:
  fields1: 
    type: fields
    fields:
      test:
        type: info
        text: "{{ page.uuid }}"

Iā€™m using Kirby 3.8.3.

Strange thing is, it seems to be enough that the page.uuid (or also page.uuid.id) is present anywhere in the blueprint ā€“ i.e. in an info field, in the help: prop of any other field and even as a data argument in Bnomeiā€™s Janitor Plugin:

button_copy_id:
  type: janitor
  command: 'janitor:clipboard --data {{ page.uuid.id }}'
  label: 'Copy Page ID to Clipboard'
  progress: Copied!
  icon: copy

I could reproduce the problem in my not so fresh Starterkit, just surprised that you couldnā€™t. Need to test later tonight in a fresh kit.

To me, that smells like a bug.

Thanks for checking. It is not urgent to me, just kept bugging meā€¦

Hi @texnixe
the error didnā€™t show in my starterkit because I forgot to set

`languages' => true

in the config, as in my main project.
If set, the error shows in a fresh starterkit.

As I now know how to reproduce the error, would it be of help if I filed an issue on github?

Yes, please. My Starterkit is multilang as well-

1 Like

Hi, I encounter the same error but I do not use page.uuid in the bleuprint affected! If this has been solved meanwhile, it would be great to have the solution posted here.

@luca Did you file the issue and where can I find it?

Thanx a lot!

There is a workaround suggested in the issue as well

:joy: you just beat me to the answer, @texnixe

2 Likes

Thank you @texnixe for the link! Meanwhile I analyzed my code and found the page.uuid causing the error in one of my custom models (instead of the blueprint ā€¦) where I take the UUID of the page to find out if there are any other pages refering to it (which of course do not with a page currently being created!):

$uuid = $this->uuid()->toString();

Changed it according to @bastianallgeier ā€™s suggestion in the issue mentioned above to:

$uuid = (string) $this->content()->get('uuid');

Works! :wink:

Hey,
has there been any progress with this? I run into a similar problem with a custom field, where I need the page uuid in some of the props. I used:

$this->model()->uuid()

to get it, which works, but on page creation I get the error message described above and also the page is created AND in addition a second one named new is created.

I tried the workaround but it seems like I donā€™t get the uuid that way. So I am wondering if there is any chance to access that uuid somehow.

Seems that there was a hickupā€¦ I now get the uuid using $this->model()->content()->get('uuid')
keep in mind that this only returns the uuid itself. I was using $this->model()->uuid() which returns page://UUID so you may need to prefix page:// when using the workaround.