41
Modules / Duplicate entry '0-' for key 'wb_mod_news_groups.ident_news'
« Last post by sternchen8875 on September 10, 2025, 01:17:13 PM »Ab und an gibt es beim Upgrade seit WB 2.10.0 zu irgendeinem Nachfolger bis hin zur aktuellen Version Abbrüche bei der Ausführung des UpgradeScripts mit dieser Fehlermeldung:
Dabei können die jeweiligen Tabellennamen unterschiedlich sein und es kann auch andere Module betreffen.
Ursache ist die "alte WB-Krankheit", immer zuerst einen leeren Eintrag zu produzieren, z.b. direkt bei der Installation oder beim Anlegen einer neuen oder auch weiteren Section des betreffenden Moduls, hier das News-Modul, Tabelle mod_news_groups
Auslöser für den jetzigen Fehler ist diese Codezeile
Aufgabe ist es, einen auf die beiden genannten Felder (hier section_id und title) bezogenen Index zu erstellen, der zum einem die Einmaligkeit (unique) eines speziellen Eintrages sicherstellt, zum anderen dafür sorgt, das Einträge schneller gefunden werden
Im vorliegendem Fall ist es so, das doppelte Einträge vorliegen, hier speziell mit der section_id == 0 (so die Fehlermeldung: Duplicate entry '0-'). Solch Index kann auf Grund der Anweisung nicht erstellt werden, das Script bricht ab.
Und weil im manuellem Upgrade der identische Code verwendet wird, führt auch das nicht zum Erfolg.
Eigentlich gibt es nur eine richtige Lösung: die (doppelten) Nuller-Einträge entfernen. Aktuell gibt es dafür keine Automatisierung. Mir persönlich wäre das auch etwas zu risikobehaftet, weil beim Upgradescript viele Tabellen durchlaufen werden, aber egal, ist nichts, was wir aktuell haben.
Im großem UpgradeScript lautet der Report in der Regel so:
Im Ordner install gibt es eine Datei ModuleWhiteList, zu öffnen mit jedem Editor (bitte aber keine Office-Programme nutzen, Notepad oder Notepad++ reichen aus)
In der Datei eine Liste mit Modulnamen. Hier muß das in der Fehlermeldung genannte Modul der Liste entnommen werden. Speichern, UpgradeScript erneut starten, fertig
damit wird das Modul vom Upgrade ausgeschlossen, natürlich keine optimale Lösung. Eine Bessere wäre es, die Ursachen zu beseitigen.
Wie behebt man nun das Ganze?
Nur in der Datenbank selbst. PhpMyAdmin ist der Freund. Man sucht die in der Fehlermeldung genannte Tabelle heraus, hier wb_mod_news_groups
nun sortieren wir die Spalte section_id. Jeden Eintrag mit section_id == 0 löschen wir.
Erledigt
engl. Translation by Google AI
Occasionally, when upgrading from WB 2.10.0 to any later version, up to the current one, the upgrade script aborts with the following error message:
Note that the specific table names can vary, and this issue can also affect other modules.
The cause is a long-standing issue in WB: the tendency to create an empty entry first. This happens, for example, during the initial installation or when creating a new or additional section for the module in question—in this case, the News module and its mod_news_groups table.
The trigger for the current error is this line of code:
The purpose of this command is to create an index on the two specified fields (section_id and title). This serves two functions: first, it ensures the uniqueness (unique) of each specific entry, and second, it helps to find entries more quickly.
In this specific case, the problem is that duplicate entries already exist, specifically with section_id == 0 (as indicated by the error message: Duplicate entry '0-'). Because of these duplicates, the index cannot be created as instructed, and the script aborts. Since the manual upgrade uses the identical code, it will also fail for the same reason.
There is really only one correct solution: remove the duplicate zero-value entries. Currently, there is no automated process for this. Personally, I would also consider it a bit too risky because the upgrade script processes many tables—but regardless, it's not a feature we have at the moment.
In the main upgrade script, the report typically looks like this:
In the install folder, there is a file named ModuleWhiteList, which can be opened with any text editor (please do not use office programs like Word; Notepad or Notepad++ are sufficient).
The file contains a list of module names. You need to remove the module mentioned in the error message from this list. Save the file, run the upgrade script again, and you're done.
This excludes the module from the upgrade process, which is, of course, not an optimal solution. A better approach would be to fix the root cause.
So, how do you actually fix the problem?
Only within the database itself. phpMyAdmin is your friend. Find the table mentioned in the error message, in this case, wb_mod_news_groups.
Now, sort by the section_id column. Delete every entry where section_id == 0.
That's it.
Quote
There was an uncatched exception
Duplicate entry '0-' for key 'wb_mod_news_groups.ident_news'
in line (836) of (/framework/class.database.php)
Dabei können die jeweiligen Tabellennamen unterschiedlich sein und es kann auch andere Module betreffen.
Ursache ist die "alte WB-Krankheit", immer zuerst einen leeren Eintrag zu produzieren, z.b. direkt bei der Installation oder beim Anlegen einer neuen oder auch weiteren Section des betreffenden Moduls, hier das News-Modul, Tabelle mod_news_groups
Auslöser für den jetzigen Fehler ist diese Codezeile
Code: [Select]
ALTER TABLE {TABLE_PREFIX}mod_news_groups ADD UNIQUE ident_news ( section_id,title(127)) USING BTREE;
Aufgabe ist es, einen auf die beiden genannten Felder (hier section_id und title) bezogenen Index zu erstellen, der zum einem die Einmaligkeit (unique) eines speziellen Eintrages sicherstellt, zum anderen dafür sorgt, das Einträge schneller gefunden werden
Im vorliegendem Fall ist es so, das doppelte Einträge vorliegen, hier speziell mit der section_id == 0 (so die Fehlermeldung: Duplicate entry '0-'). Solch Index kann auf Grund der Anweisung nicht erstellt werden, das Script bricht ab.
Und weil im manuellem Upgrade der identische Code verwendet wird, führt auch das nicht zum Erfolg.
Eigentlich gibt es nur eine richtige Lösung: die (doppelten) Nuller-Einträge entfernen. Aktuell gibt es dafür keine Automatisierung. Mir persönlich wäre das auch etwas zu risikobehaftet, weil beim Upgradescript viele Tabellen durchlaufen werden, aber egal, ist nichts, was wir aktuell haben.
Im großem UpgradeScript lautet der Report in der Regel so:
Quote
[06] : Upgrade module form from version 3.5.1 to version 3.5.1 OK
[07] : Upgrade module jsadmin from version 2.1.4 to version 2.1.4 OK
[08] : Upgrade module menu_link from version 3.0.4 to version 3.0.4 OK
There was an uncatched exception
Duplicate entry '0-' for key 'wb_mod_news_groups. ident_news'
in line (836) of (/framework/class.database.php):
Im Ordner install gibt es eine Datei ModuleWhiteList, zu öffnen mit jedem Editor (bitte aber keine Office-Programme nutzen, Notepad oder Notepad++ reichen aus)
In der Datei eine Liste mit Modulnamen. Hier muß das in der Fehlermeldung genannte Modul der Liste entnommen werden. Speichern, UpgradeScript erneut starten, fertig
damit wird das Modul vom Upgrade ausgeschlossen, natürlich keine optimale Lösung. Eine Bessere wäre es, die Ursachen zu beseitigen.
Wie behebt man nun das Ganze?
Nur in der Datenbank selbst. PhpMyAdmin ist der Freund. Man sucht die in der Fehlermeldung genannte Tabelle heraus, hier wb_mod_news_groups
nun sortieren wir die Spalte section_id. Jeden Eintrag mit section_id == 0 löschen wir.
Erledigt
engl. Translation by Google AI
Occasionally, when upgrading from WB 2.10.0 to any later version, up to the current one, the upgrade script aborts with the following error message:
Quote
There was an uncatched exception
Duplicate entry '0-' for key 'wb_mod_news_groups.ident_news'
in line (836) of (/framework/class.database.php)
Note that the specific table names can vary, and this issue can also affect other modules.
The cause is a long-standing issue in WB: the tendency to create an empty entry first. This happens, for example, during the initial installation or when creating a new or additional section for the module in question—in this case, the News module and its mod_news_groups table.
The trigger for the current error is this line of code:
Code: [Select]
ALTER TABLE {TABLE_PREFIX}mod_news_groups ADD UNIQUE ident_news ( section_id,title(127)) USING BTREE;
The purpose of this command is to create an index on the two specified fields (section_id and title). This serves two functions: first, it ensures the uniqueness (unique) of each specific entry, and second, it helps to find entries more quickly.
In this specific case, the problem is that duplicate entries already exist, specifically with section_id == 0 (as indicated by the error message: Duplicate entry '0-'). Because of these duplicates, the index cannot be created as instructed, and the script aborts. Since the manual upgrade uses the identical code, it will also fail for the same reason.
There is really only one correct solution: remove the duplicate zero-value entries. Currently, there is no automated process for this. Personally, I would also consider it a bit too risky because the upgrade script processes many tables—but regardless, it's not a feature we have at the moment.
In the main upgrade script, the report typically looks like this:
Quote
: Upgrade module form from version 3.5.1 to version 3.5.1 OK
: Upgrade module jsadmin from version 2.1.4 to version 2.1.4 OK
: Upgrade module menu_link from version 3.0.4 to version 3.0.4 OK
There was an uncatched exception
Duplicate entry '0-' for key 'wb_mod_news_groups. ident_news'
in line (836) of (/framework/class.database.php):
In the install folder, there is a file named ModuleWhiteList, which can be opened with any text editor (please do not use office programs like Word; Notepad or Notepad++ are sufficient).
The file contains a list of module names. You need to remove the module mentioned in the error message from this list. Save the file, run the upgrade script again, and you're done.
This excludes the module from the upgrade process, which is, of course, not an optimal solution. A better approach would be to fix the root cause.
So, how do you actually fix the problem?
Only within the database itself. phpMyAdmin is your friend. Find the table mentioned in the error message, in this case, wb_mod_news_groups.
Now, sort by the section_id column. Delete every entry where section_id == 0.
That's it.