Error when updating content

System Information
  • Strapi Version: 5.5.1
  • Operating System: Windows 11
  • Database: Mysql
  • Node Version: 20.14.0
  • NPM Version: 10.7.0
  • Yarn Version: 1.22.17

Hi,

I meet a strange behavior on my strapi v5 when trying to update (in the admin panel) a content-type.
Here is my case:

  • I have 2 content-type : chapter and section
  • chapter has 2 fields : name (text type) and rank (number type)
  • section has 2 fields : name (text type), chapter (relation oneToOne with chapter content type)
    Everything is OK after creating these content-type

Then, I create contents like this :

  • create a new chapter entry with these values : [name=Chapter1] (I let the rank field empty), and I publish it, all is fine…
  • create a new section entry with these values : [name=Section1, chapter=Chapter1], publish it, all is fine…

BUT : when I edit my “Chapter1” entry and set the rank field and publish it, I got an error from Strapi saying “Warning: Internal server error” and in console :
“error: insert into chapter_section_lnk (chapter_id, id, section_id) values (5, 4, 7) - Duplicata du champ ‘4’ pour la clef ‘PRIMARY’”

What I see when checking the database after updating my chapter entry is :

  • Strapi delete the current one and insert a new entry (I am sure of that because the id of my published record was increased) : why ?
  • then Strapi insert a new record in chapter_section_lnk with the new chapter_id BUT with the same chapter_section_lnk.id : this is why the error occurs
    Am I the only one having this strange behavior ?

Thank you