Duplicate key when add new document

hi ,
I have imported data to my database for working on
when trying to add new doc like that

@frappe.whitelist(allow_guest=True)
def add_tag(tag_title):
New_Tag = frappe.get_doc({
“doctype”: “Tags”,
“title”: tag_title
}).insert(ignore_permissions=True)

I got duplicate primary key , 409 status code
error
File “/home/atallah/frappe-bench/apps/frappe/frappe/database.py”, line 110, in sql
self._cursor.execute(query, values)
File “/home/atallah/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/atallah/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
NameError: (u’Tags’, u’TAG00022’, IntegrityError(1062, “Duplicate entry ‘TAG00022’ for key ‘PRIMARY’”)

so how can i make frappe to generate no existing key ?
thanks

Version 4 has a bug that it does not update the series for imports, you will have to fix your series manually

https://kb.erpnext.com/kb/setup/naming-series-current-value