diff --git a/product/ERP5/Tool/IdTool.py b/product/ERP5/Tool/IdTool.py
index 422951eccbef1f6024c7431cd99ff44242390ccd..4359bac371286cd5d710da2b7125e212534c2a6c 100644
--- a/product/ERP5/Tool/IdTool.py
+++ b/product/ERP5/Tool/IdTool.py
@@ -193,7 +193,7 @@ class IdTool(BaseTool):
       last_generator = self._getLatestGeneratorValue(id_generator)
       new_id_list = last_generator.generateNewIdList(id_group=id_group,
                          id_count=id_count, default=default)
-    except KeyError:
+    except (KeyError, ValueError):
       template_tool = getattr(self, 'portal_templates', None)
       revision = template_tool.getInstalledBusinessTemplateRevision('erp5_core')
       # XXX backward compatiblity