diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml
index 89a9d39e81fd679706510c5545a690269fc612e9..caf87226c0ed3eafbd54407a044b74c383ef86c5 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml
@@ -247,6 +247,14 @@ for table_name in spreadsheets.keys():\n
             # (i.e. its tranformation to ID is not the same as the original value)\n
             if clean_title != cell_id:\n
               category_properties[\'title\'] = clean_title\n
+\n
+          # Detect duplicate IDs\n
+          #if path_elements and path_elements[-1][\'depth\'] == element_depth:\n
+          for element in path_elements[::-1]:\n
+            if element[\'depth\'] != element_depth:\n
+              break\n
+            if element[\'value\'] == path_element_id:\n
+              raise ValueError("Duplicate id %s" % element[\'value\'])\n
 \n
           # Save the path element\n
           path_elements.append({ \'depth\': element_depth\n
@@ -355,6 +363,7 @@ return categories_spreadsheet_mapping\n
                             <string>element</string>
                             <string>path</string>
                             <string>clean_title</string>
+                            <string>ValueError</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision
index 487d273ddaf2d90947797f377d091c4b08061a64..337488c9dcc44acb6ebc2ed4c905d8dcb0da0ecb 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/revision
+++ b/product/ERP5/bootstrap/erp5_core/bt/revision
@@ -1 +1 @@
-1040
\ No newline at end of file
+1042
\ No newline at end of file