Error while creating a new archival institution

Skip to first unread message

Martin Longo

Jun 8, 2020, 2:19:05 PM6/8/20
to AtoM Users
Hello there again ...

Our Atom installation was successfully upgraded from 1.3.1 to version 2.5.4 after solving some problems (!topic/ica-atom-users/9T7EJGNfVaw) and everything that was working with the old version is working now.

Nevertheless, I'm facing a problem when I want to add an archival institution. I keep getting an 500 error and the corresponding error in the logs:

2020/06/08 14:38:36 [error] 724#724: *509 FastCGI sent in stderr: "PHP message: Unable to execute INSERT statement. [wrapped: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`atom25`.`note`, CONSTRAINT `note_FK_2` FOREIGN KEY (`type_id`) REFERENCES `term` (`id`) ON DELETE SET NULL)]" while reading response header from upstream, client:, server: _, request: "POST /index.php/repository/add HTTP/1.1", upstream: "fastcgi://unix:/run/php7.2-fpm.atom.sock:", host: "", referrer: ""

I searched for post related to this problem and tried what was suggested in this one (with no luck):

Not sure if it related to this problem, but if I want to "Browse" -> Repositories, I get no results while I think there should be at least one .... (checking the database I see that the "repository" table has one record)....

Thanks in advance for any tip or pointer about this problem!

Dan Gillean

Jun 8, 2020, 4:50:08 PM6/8/20
to ICA-AtoM Users
Hi Martin, 

I'm going to ask one of our developers to respond on thread with further ideas. In the meantime, I suggest that you take a look at the section in our Troubleshooting documentation on Data corruption. Running some of the recommended tasks (such as regenerating slugs and rebuilding the nested set) and some of the queries (to determine if some of the issues you are experiencing are related to more pernicious corruption in the database should at least help us rule out some possible causes and gather more information. See: 
In the meantime, we're working on improving the foreign key declarations in the upcoming 2.6 release, which should hopefully help us avoid some of these issues in the future. See: 
More soon, hopefully! In the meantime, please share any relevant info you find from your investigations. 


Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
he / him

You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

José Raddaoui

Jun 9, 2020, 9:48:40 AM6/9/20
to AtoM Users
Hi Martin,

Reading the error and the related thread, it looks like the issue could be a missing term in the database. However, when I create a repository with only the identifier, AtoM automatically adds a maintenance note related to that repository and that note type term seems to be in AtoM since 1.x. Could you check that this is really the issue in your case?

SELECT * FROM object o, term t, term_i18n i18n WHERE AND AND AND i18n.culture='en';

After connecting to the AtoM database, that statement should show you if the "Maintenance note" term exists. Please, let us know the result so we can follow-up.

Best regards.

Martin Longo

Jun 9, 2020, 1:10:38 PM6/9/20
Hi there José...
Thanks for the pointer on my problem...

I have executed the query you suggested and it returned no results... so the missing "Maintenance note" term might be the problem... or at least a part of it. Since this is an upgraded installation from 1.3 I don't know why it doesn't exist.

Is this a term I should add via the Atom interface or should be inserted directly into the database?

You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to

José Raddaoui

Jun 10, 2020, 8:38:09 AM6/10/20
to AtoM Users
Thanks Martin,

I may be wrong about this, but my initial impression is that the issue already existed in 1.3 and that it was probably introduced in a previous upgrade from 1.x to 1..x. It has appeared now for one of two reasons, either it's just the first archival institution being created (the one in the repository table is the root repository, used for permissions) or it's related to the MySQL 5.7 upgrade and the inclusion of STRICT_TRANS_TABLES in the sql_mode (see for more information about this issue).

You could use some SQL queries and existing tasks to add the term but I have created the following script to do it in one go:

Place that script in the AtoM folder and (also located in the AtoM folder) run:

php symfony tools:run add_maintenance_note_term.php

It will fail if there is something using the id already. Otherwise, it will create the term as in a new install (with all translations). Please, let us know how it goes.

Best regards,
To unsubscribe from this group and stop receiving emails from it, send an email to
Reply all
Reply to author
0 new messages