Languages

Duplicate entry 'en-373-AM'

 
This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Picture of Boris Puhanic
Duplicate entry 'en-373-AM'
 

I'm using Moodle 2.3.3 (Build: 20121112).

I'm trying to open the English language pack for editing, but I get the following debugging error:

Debug info: Duplicate entry 'en-373-AM' for key 'mdl_toolcust_lancomstr_uix' INSERT INTO mdl_tool_customlang (lang,componentid,stringid,original,master,timemodified,outdated,local,timecustomized) VALUES(?,?,?,?,?,?,?,?,?) [array ( 0 => 'en', 1 => '373', 2 => 'AM', 3 => 'AM', 4 => 'AM', 5 => 1357906576, 6 => 0, 7 => NULL, 8 => NULL, )] Error code: dmlwriteexception Stack trace:

line 410 of /lib/dml/moodle_database.php: dml_write_exception thrown
line 1050 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 1092 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
line 190 of /admin/tool/customlang/locallib.php: call to mysqli_native_moodle_database->insert_record()
line 60 of /admin/tool/customlang/index.php: call to tool_customlang_utils::checkout()

Any help solving this would be appreciated.

Thanks, Boris.

 
Average of ratings: -
Picture of David Mudrák
Re: Duplicate entry 'en-373-AM'
Group Core developersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Plugin developersGroup Plugins guardiansGroup TestersGroup Translators
Hi Boris

I am guessing this is caused by the block_tts you have probably installed as an extension. The block used to define string 'am' as well as the string 'AM' which causes the conflict at some databases (like yours probably). I just checked the block source code repository and it seems the maintainer fixed this 2 months ago (https://github.com/oohoo/moodle-block_tts/commit/f299ddc552c75218c7e6cdf899046be21a01af73).

Please try to upgrade the block to the most recent version available at https://moodle.org/plugins/view.php?plugin=block_tts
 
Average of ratings: -
Picture of Boris Puhanic
Re: Duplicate entry 'en-373-AM'
 

 Thanks, David.  That fixed it.

 
Average of ratings: -
Dogbert rules!
Re: Duplicate entry 'en-373-AM'
 

Moodle 2.4.5+ (Build: 20130815)

I am also receiving a similar message.  How did you determine (from the code) that it was the block_tts?  I do not have that block installed.

I am wondering if I can simply delete the record from the mdl_tool_customlang table, but I do not want something to go wrong.

Please help.  Thank you.


Debug info: Duplicate entry 'en_us-401-m' for key 'm2_toolcust_lancomstr_uix'
INSERT INTO m2_tool_customlang (lang,componentid,stringid,original,master,timemodified,outdated,local,timecustomized) VALUES(?,?,?,?,?,?,?,?,?)
[array (
0 => 'en_us',
1 => '401',
2 => 'm',
3 => 'm',
4 => 'm',
5 => 1411503183,
6 => 0,
7 => NULL,
8 => NULL,
)]
Error code: dmlwriteexception
Stack trace:
  • line 429 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 1107 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1149 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
  • line 190 of /admin/tool/customlang/locallib.php: call to mysqli_native_moodle_database->insert_record()
  • line 60 of /admin/tool/customlang/index.php: call to tool_customlang_utils::checkout()
 
Average of ratings: -
Dogbert rules!
Re: Duplicate entry 'en-373-AM'
 

Nevermind...located the problem.  It had to do with a question type dealing with Music Intervals.  The question types were simply removed and all worked perfectly. 

 
Average of ratings: -
Picture of Joshua Bragg
Re: Duplicate entry 'en-373-AM'
Group Testers

So I've seen a couple of these posts around here and they all end with David Mudrak appearing with the plugin that is causing the conflict.  So David, how do you figure out which plugin is the problem?

I'm getting this message at the moment:

Default exception handler: Error writing to database Debug: Duplicate entry 'en_us-175-style' for key 'mdl_toolcust_lancomstr_uix' INSERT INTO mdl_tool_customlang (lang,componentid,stringid,original,master,timemodified,outdated,local,timecustomized) VALUES(?,?,?,?,?,?,?,?,?)\n[array (\n  0 => 'en_us',\n  1 => '175',\n  2 => 'style',\n  3 => 'Style',\n  4 => 'Style',\n  5 => 1435682815,\n  6 => 0,\n  7 => NULL,\n  8 => NULL,\n)]\nError code: dmlwriteexception\n* line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown\n* line 1164 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()\n* line 1210 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()\n* line 186 of /admin/tool/customlang/locallib.php: call to mysqli_native_moodle_database->insert_record()\n* line 60 of /admin/tool/customlang/index.php: call to tool_customlang_utils::checkout()\n


 
Average of ratings: -
Picture of David Mudrák
Re: Duplicate entry 'en-373-AM'
Group Core developersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Plugin developersGroup Plugins guardiansGroup TestersGroup Translators

In your case, the problematic entry is en_us-175-style. If you have access to your database, you can find out quickly the component from the table tool_customlang_components

SELECT * FROM mdl_tool_customlang_components WHERE id = 175;

I do not have access to people's databases and the way I did it is that I go to lang.moodle.org and use the AMOS tool to find all the strings with the given string identifier - which is style in your case.

Via searching for that string I can have suspicion that it would be block_dataform_view or dataformembed or filter_jmol.

Of these three ones, knowing that you are chemistry teacher, you probably have the filter installed. So I searched for the changes in the language string files of that filter and I found the fix https://github.com/geoffrowland/moodle-filter_jmol/commit/ba92b898b62d0144a72ede9dc4651ed9d0a0ac5f#diff-558d72cb4d601fd69503c8602bfb2cb3 that explains the error message you are experiencing. That fix is quite old and is present in recent versions of the filter.

Let me suggest to update your jmol filter to the most recent version.

Hope this helps and clarifies smile

 
Average of ratings: Useful (6)
Picture of Joshua Bragg
Re: Duplicate entry 'en-373-AM'
Group Testers
That is indeed helpful but makes it also a bit more strange.  The problem is the Jmol filter.  I don't have the others installed. But I have the latest version of Jmol installed...  I actually just went into the code to verify that the particular change you indicated is indeed in my code copy.  Any more ideas?
 
Average of ratings: -
Picture of David Mudrák
Re: Duplicate entry 'en-373-AM'
Group Core developersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Plugin developersGroup Plugins guardiansGroup TestersGroup Translators

Ah, right. There is probably the old string still registered in the tool_customlang table and it causes the unique index violation.

Are you able to execute an SQL like

DELETE FROM mdl_tool_customlang WHERE componentid = 175 AND stringid = 'Style';

That should help you to get rid of the offending legacy string with the unexpected identifier.

 
Average of ratings: Useful (2)
Picture of Joshua Bragg
Re: Duplicate entry 'en-373-AM'
Group Testers

Worked like a charm.  Thanks David!

 
Average of ratings: -
Picture of David Heuring
Re: Duplicate entry 'en-373-AM'
 

David,

I'm trying to restore a large course with users.  I also recently upgraded from 2.8.1 to 2.9.1+ (Build 20150723).  You seem to have the magic touch for resolving this db error:

Debug info: Duplicate entry '209-0-0-0' for key 'mdl_assisubm_assusegroatt_uix'
INSERT INTO mdl_assign_submission (userid,timecreated,timemodified,status,groupid,attemptnumber,latest,assignment) VALUES(?,?,?,?,?,?,?,?)
[array (
0 => 0,
1 => 1416300384,
2 => 1416300384,
3 => 'new',
4 => 0,
5 => '0',
6 => 0,
7 => 209,
)]
Error code: dmlwriteexception
Stack trace:
  • line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 1164 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1210 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
  • line 163 of /mod/assign/backup/moodle2/restore_assign_stepslib.php: call to mysqli_native_moodle_database->insert_record()
  • line 137 of /backup/util/plan/restore_structure_step.class.php: call to restore_assign_activity_structure_step->process_assign_submission()
  • line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
  • line 178 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
  • line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
  • line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
  • line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
  • line 190 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
  • line 278 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
  • line ? of unknownfile: call to progressive_parser->end_tag()
  • line 179 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
  • line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
  • line 110 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
  • line 181 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
  • line 195 of /backup/moodle2/restore_activity_task.class.php: call to base_task->execute()
  • line 177 of /backup/util/plan/base_plan.class.php: call to restore_activity_task->execute()
  • line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
  • line 333 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
  • line 224 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
  • line 111 of /backup/restore.php: call to restore_ui->execute()
I have direct access to my database.  It looks to me like there is a duplicate user or something similar.  But I can't seem to find - 416300384 in any of the data fields.  Really appreciate any help you can offer.

Thanks,

Dave

 
Average of ratings: -
Me!
Re: Duplicate entry 'en-373-AM'
Group Core developersGroup Moodle HQGroup Particularly helpful MoodlersGroup Plugin developersGroup Testers
It looks like some bad data in the backup file. I would look through the backup file (they are either tgz or zip files containing a series of xml files) for a file named assign.xml (in a sub folder named activities/assign_/). In that file look for submissions with userid = 0 and groupid = 0 and delete them.

When you are finished - re-zip the file back together and try and restore from that.


Also - if you can reproduce this reliably can you please create an issue in the Moodle Tracker for it?

Thanks!
 
Average of ratings: -
Picture of David Heuring
Re: Duplicate entry 'en-373-AM'
 

I appreciate the suggestion, Damyon.  I may need some additional guidance, though.  The backup file is a .mbz type so should I download that?  If so, once downloaded, how would I open it to look for the XML files? 

I have terminal access to the server and could look for it there but not sure of the location or, once again, how to open a .mbz file.  Sorry for being so naive but I really don't know how these backups work.

I've done some testing with other backup files and they all restore correctly so it is only this one that is giving me a problem.  It is large with nearly 500 mega of data.

Thanks much for your advice.

David

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Duplicate entry 'en-373-AM'
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers

Yes, you need to download the .mbz file.

Depending on which version of Moodle you have, that is either a .zip or a .tgz file in disguise, so rename the file extension and try de-compressing it.

Once you have de-compressed it you will find a whole lot of .xml files, with names that are fairly self-explanatory.

 
Average of ratings: -
Picture of David Heuring
Re: Duplicate entry 'en-373-AM'
 

Okay, did as suggested and then tried to do another restore for the backup.  It took quite a awhile (it is a big course) and then got a WSOD.  A refresh page showed the the following error message.

A required parameter (contextid) was missing

More information about this error
Debug info:
Error code: missingparam
Stack trace:

    line 463 of /lib/setuplib.php: moodle_exception thrown
    line 548 of /lib/moodlelib.php: call to print_error()
    line 7 of /backup/restore.php: call to required_param()

This looks like a different problem.


 
Average of ratings: -
Picture of David Mudrák
Re: Duplicate entry 'en-373-AM'
Group Core developersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Plugin developersGroup Plugins guardiansGroup TestersGroup Translators
I am afraid this new error is kind of expected. These screens can't be simply reloaded. The WSOD may suggest some error related to the server resources - available memory or max execution time. Are you able to raise the Moodle's debugging level and turn debug messages display on? If so, do so and repeat the restore. Alternatively, if you can, check the web server log. In common configurations, the details about the error should be reported there.
 
Average of ratings: -
Picture of David Heuring
Re: Duplicate entry '243-0-0-0' for key 'mdl_assisubm_assusegroatt_uix'
 

Okay, I went back to the original backup (before I unzipped it and made changes), turned on a higher level of debugging, and then tried to restore the backup.  No WSOD this time but it stopped at 30% with the following error messages:

------------------------------------------------

Notice: Constant ASSIGNSUBMISSION_ONLINEPOODLL_FILEAREA already defined in /home/amideastonline/public_html/mod/assign/submission/onlinepoodll/locallib.php on line 37

Notice: Constant ASSIGNSUBMISSION_ONLINEPOODLL_COMPONENT already defined in /home/amideastonline/public_html/mod/assign/submission/onlinepoodll/locallib.php on line 38

Notice: Constant ASSIGNSUBMISSION_ONLINEPOODLL_TABLE already defined in /home/amideastonline/public_html/mod/assign/submission/onlinepoodll/locallib.php on line 40
get_context_instance() is deprecated, please use context_xxxx::instance() instead.

    line 3331 of /lib/deprecatedlib.php: call to debugging()
    line 185 of /mod/nanogong/lib.php: call to get_context_instance()
    line 4792 of /lib/moodlelib.php: call to nanogong_delete_instance()
    line 4673 of /lib/moodlelib.php: call to remove_course_contents()
    line 236 of /backup/util/ui/restore_ui.class.php: call to delete_course()
    line 118 of /backup/restore.php: call to restore_ui->cleanup()

Error writing to database

More information about this error
Debug info: Duplicate entry '243-0-0-0' for key 'mdl_assisubm_assusegroatt_uix'
INSERT INTO mdl_assign_submission (userid,timecreated,timemodified,status,groupid,attemptnumber,latest,assignment) VALUES(?,?,?,?,?,?,?,?)
[array (
0 => 0,
1 => 1416300384,
2 => 1416300384,
3 => 'new',
4 => 0,
5 => '0',
6 => 0,
7 => 243,
)]
Error code: dmlwriteexception
Stack trace:

    line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown
    line 1164 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
    line 1210 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
    line 163 of /mod/assign/backup/moodle2/restore_assign_stepslib.php: call to mysqli_native_moodle_database->insert_record()
    line 137 of /backup/util/plan/restore_structure_step.class.php: call to restore_assign_activity_structure_step->process_assign_submission()
    line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
    line 178 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
    line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
    line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
    line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
    line 190 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
    line 278 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
    line ? of unknownfile: call to progressive_parser->end_tag()
    line 179 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
    line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
    line 110 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
    line 181 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
    line 195 of /backup/moodle2/restore_activity_task.class.php: call to base_task->execute()
    line 177 of /backup/util/plan/base_plan.class.php: call to restore_activity_task->execute()
    line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
    line 333 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
    line 224 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
    line 111 of /backup/restore.php: call to restore_ui->execute()

--------------------------------------------------

Does this help show what the problem is?

Thanks again for any advice/feedback!

 
Average of ratings: -
Picture of David Mudrák
Re: Duplicate entry '243-0-0-0' for key 'mdl_assisubm_assusegroatt_uix'
Group Core developersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Plugin developersGroup Plugins guardiansGroup TestersGroup Translators

OK, it takes us somewhere. It seems you have at least Online PoodLL submissions plugin installed and that it is involved. I think that Justin Hunt, the author and maintainer of the plugin, might be able to give you more information and support.

 
Average of ratings: -
Picture of Jason Sanders
Re: Duplicate entry '243-0-0-0' for key 'mdl_assisubm_assusegroatt_uix'
 

Hi all,

I am having the same issue with multiple courses.  We recently upgraded our Moodle server from 2.6 to 2.9. I am attempting to restore a course from an mbz backup file.  The backup file was created in Moodle 2.6 and the restore is in 2.9.  I keep getting a similar error as discussed above.  I have pasted it below.  It looks like there is a duplicate entry causing the problem, but I have deleted corresponding courses and attempted to work around the issue, all for not.  Any suggested steps would be appreciated.  Thanks!

Error writing to database

More information about this error

Debug info: Duplicate entry '37683-0-0' for key 'mdl_assigrad_assuseatt_uix'
INSERT INTO mdl_assign_grades (userid,timecreated,timemodified,grader,grade,attemptnumber,assignment) VALUES(?,?,?,?,?,?,?)
[array (
0 => 0,
1 => 1378322760,
2 => 1378417624,
3 => '6084',
4 => '90.00000',
5 => '0',
6 => 37683,
)]
Error code: dmlwriteexception
Stack trace:
  • line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 1164 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1210 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
  • line 234 of /mod/assign/backup/moodle2/restore_assign_stepslib.php: call to mysqli_native_moodle_database->insert_record()
  • line 137 of /backup/util/plan/restore_structure_step.class.php: call to restore_assign_activity_structure_step->process_assign_grade()
  • line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
  • line 178 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
  • line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
  • line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
  • line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
  • line 190 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
  • line 237 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
  • line ? of unknownfile: call to progressive_parser->start_tag()
  • line 179 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
  • line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
  • line 110 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
  • line 181 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
  • line 195 of /backup/moodle2/restore_activity_task.class.php: call to base_task->execute()
  • line 177 of /backup/util/plan/base_plan.class.php: call to restore_activity_task->execute()
  • line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
  • line 333 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
  • line 224 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
  • line 111 of /backup/restore.php: call to restore_ui->execute()

 
Average of ratings: -
Picture of Germán Valero
Re: Duplicate entry 'en-373-AM'
Group Documentation writersGroup Particularly helpful MoodlersGroup Plugin developersGroup TestersGroup Translators

Hi David,

I tried to put some of this useful information in the Moodle Docs page at https://docs.moodle.org/29/en/Installing_plugins#Default_exception_handler:_Error_writing_to_database_Debug:_Duplicate_entry_.27en_us-...

Can you please have a look at it and correct/expand/move as needed?

Thanks once more smile


 
Average of ratings: -