Bench update UniqueValidationError Duplicate entry ‘Patient-Administrator-1’

Hi,
dear, as i had run the bench update command the following error came and when i tried to the command bench update --reset the below error came can you please help me out in this.

Thanks.
trinity@trinity:~$ cd frappe-brnch
bash: cd: frappe-brnch: No such file or directory
trinity@trinity:~$ cd frappe-bench
trinity@trinity:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages

Cannot proceed with update: You have local changes in app “frappe” that are not committed.

Here are your choices:

  1. Merge the frappe app manually with “git pull” / “git pull --rebase” and fix conflicts.
  2. Temporarily remove your changes with “git stash” or discard them completely
    with “bench update --reset” or for individual repositries “git reset --hard”
  3. If your changes are helpful for others, send in a pull request via GitHub and
    wait for them to be merged in the core.
    trinity@trinity:~/frappe-bench$ bench update --reset
    INFO:bench.utils:updating bench
    INFO:bench.utils:git pull
    Already up-to-date.
    INFO:bench.utils:./env/bin/pip install Pillow
    Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
    INFO:bench.app:pulling frappe
    INFO:bench.utils:git fetch --all
    Fetching upstream
    INFO:bench.utils:git reset --hard upstream/develop
    HEAD is now at d66cf3d Merge pull request #4970 from frappe/raghukamath-patch-1
    INFO:bench.utils:find . -name “.pyc" -delete
    INFO:bench.app:pulling erpnext
    INFO:bench.utils:git fetch --all
    Fetching upstream
    INFO:bench.utils:git reset --hard upstream/develop
    HEAD is now at 211b6c1 Merge branch ‘vishdha-gstr2_report’ into develop
    INFO:bench.utils:find . -name "
    .pyc” -delete
    Updating Python libraries…
    INFO:bench.utils:./env/bin/pip install --upgrade pip
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    INFO:bench.utils:./env/bin/pip install -q -r /home/trinity/.bench/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/requirements.txt
    Updating node libraries…
    INFO:bench.utils:npm install
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
    npm WARN frappe@ No description
    Backing up sites…
    Patching sites…
    Migrating pushpahosiery
    Updating DocTypes for frappe : [========================================]
    Updating DocTypes for erpnext : [========================================]
    Traceback (most recent call last):
    File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
    main”, fname, loader, pkg_name)
    File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
    exec code in run_globals
    File “/home/trinity/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
    main()
    File “/home/trinity/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/home/trinity/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
    return self.main(*args, **kwargs)
    File “/home/trinity/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
    rv = self.invoke(ctx)
    File “/home/trinity/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/trinity/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/trinity/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/trinity/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
    return callback(*args, **kwargs)
    File “/home/trinity/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
    File “/home/trinity/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
    File “/home/trinity/frappe-bench/apps/frappe/frappe/commands/site.py”, line 222, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
    File “/home/trinity/frappe-bench/apps/frappe/frappe/migrate.py”, line 45, in migrate
    sync_desktop_icons()
    File “/home/trinity/frappe-bench/apps/frappe/frappe/desk/doctype/desktop_icon/desktop_icon.py”, line 319, in sync_desktop_icons
    sync_from_app(app)
    File “/home/trinity/frappe-bench/apps/frappe/frappe/desk/doctype/desktop_icon/desktop_icon.py”, line 355, in sync_from_app
    desktop_icon.save()
    File “/home/trinity/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
    return self._save(*args, **kwargs)
    File “/home/trinity/frappe-bench/apps/frappe/frappe/model/document.py”, line 279, in _save
    self.insert()
    File “/home/trinity/frappe-bench/apps/frappe/frappe/model/document.py”, line 230, in insert
    self.db_insert()
    File “/home/trinity/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 318, in db_insert
    self.show_unique_validation_message(e)
    File “/home/trinity/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 366, in show_unique_validation_message
    raise frappe.UniqueValidationError(self.doctype, self.name, e)
    frappe.exceptions.UniqueValidationError: (u’Desktop Icon’, ‘92fcca7b8c’, IntegrityError(1062, u"Duplicate entry ‘Patient-Administrator-1’ for key ‘unique_module_name_owner_standard’"))
    trinity@trinity:~/frappe-bench$ ls
    apps env node_modules patches.txt sites
    config logs package.json Procfile

A search like this Search results for 'unique_module_name_owner_standard' - Frappe Forum

gets you tips to try like this Module_name_owner_standard must be unique - #14 by richardxix

hope this helps

sorry, but i could not find the solution in that. can you please guide any thing in it more.

“I have found if you go to the icon list and make 1 of the icons ‘standard’, and delete any duplicates, that I don’t get this error.”

i tried it buy the same error

The problem is you have more than one Patient-Administrator.

Unless you can find the duplicate user via the UI, you will need to fix that problem in the database.

Edit: run ‘bennh mysql’ to inspect the database for eg.

select name,module_name,owner from `tabDesktop Icon` where module_name='Healthcare';

hi all,

i am getting same error during doing bench update

File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 318, in db_insert
self.show_unique_validation_message(e)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 366, in show_unique_validation_message
raise frappe.UniqueValidationError(self.doctype, self.name, e)
frappe.exceptions.UniqueValidationError: (u’Desktop Icon’, ‘2db8e36874’, IntegrityError(1062, u"Duplicate entry ‘Patient-Administrator-1’ for key ‘unique_module_name_owner_standard’"))

Then, bench mariadb

> select name,module_name,owner from `tabDesktop Icon` where module_name='Healthcare';
+------------+-------------+---------------+
| name       | module_name | owner         |
+------------+-------------+---------------+
| bfc9b7adc9 | Healthcare  | Administrator |
+------------+-------------+---------------+
1 row in set
Time: 0.099s

Please show me how to fix it.
Thanks a lot.

This case is like yours, but applies in the Schools domain [SOLVED] Can not install ERPNext for Schools - #4 by Ben_Cornwell_Mott

yeah, but i am unable to login to my site.
it shows error page, cause the update is still not completed

ok what I suggest

Query the database for Patient-Administrator-1, your problem source

In [Error] module_name_owner_standard must be unique · Issue #8052 · frappe/erpnext · GitHub

tundebabzy and franzos refer to this query

select module_name, owner, standard from `tabDesktop Icon`;

My theory is that the standard flag is set twice that raises the duplication error…

Hi Mr. clarkej

i had run the command as you mentioned and after that i got the below table

trinity@trinity:~/frappe-bench$ bench mariadb
Version: 1.16.0
Chat: dbcli/mycli - Gitter
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - orpharion bestheneme
pushpahosiery> select name,module_name,owner from tabDesktop Icon wh
→ ere module_name=‘Healthcare’;
±-----------±------------±----------------------------+
| name | module_name | owner |
±-----------±------------±----------------------------+
| e549e52d7c | Healthcare | Administrator |
| 8fb8e423f4 | Healthcare | Administrator |
| baa5baaca8 | Healthcare | praveen1950kamboj@gmail.com |
±-----------±------------±----------------------------+
3 rows in set
Time: 0.269s
pushpahosiery>

can you please help to make change in it as i don’t know more about this how to correct it.
thanks

Best to theorize and diagnose the problem first!

Please your feedback on my post # 9 - query your database to discover what
‘Patient-Administrator-1’ and ‘standard’ flag are about…

still don’t know how to fix the issue :frowning:

select module_name, owner, standard from tabDesktop Icon;
±--------------------------±--------------±---------+
| module_name | owner | standard |
±--------------------------±--------------±---------+
| Accounts | Administrator | 1 |
| Agriculture | Administrator | 1 |
| Agriculture Task | Administrator | 1 |
| Assets | Administrator | 1 |
| BOM | Administrator | 1 |
| Buying | Administrator | 1 |
| Chapter | Administrator | 1 |
| Consultation | Administrator | 1 |
| Contacts | Administrator | 1 |
| Core | Administrator | 1 |
| Course | Administrator | 1 |
| Course Schedule | Administrator | 1 |
| CRM | Administrator | 1 |
| Crop | Administrator | 1 |
| Crop Cycle | Administrator | 1 |
| Customer | Administrator | 1 |
| Data Import | Administrator | 1 |
| Desk | Administrator | 1 |
| Disease | Administrator | 1 |
| Donor | Administrator | 1 |
| Education | Administrator | 1 |
| Email Inbox | Administrator | 1 |
| Employee | Administrator | 1 |
| Expense Claim | Administrator | 1 |
| Fees | Administrator | 1 |
| Fertilizer | Administrator | 1 |
| File Manager | Administrator | 1 |
| Grant Application | Administrator | 1 |
| Healthcare | Administrator | 1 |
| HR | Administrator | 1 |
| Hub | Administrator | 1 |
| Instructor | Administrator | 1 |
| Integrations | Administrator | 1 |
| Issue | Administrator | 1 |
| Item | Administrator | 1 |
| Lab Test | Administrator | 1 |
| Land Unit | Administrator | 1 |
| Lead | Administrator | 1 |
| Leaderboard | Administrator | 1 |
| Learn | Administrator | 1 |
| Maintenance | Administrator | 1 |
| Manufacturing | Administrator | 1 |
| Member | Administrator | 1 |
| Non Profit | Administrator | 1 |
| Patient | Administrator | 1 |
| Patient Appointment | Administrator | 1 |
| Plant Analysis | Administrator | 1 |
| POS | Administrator | 1 |
| Production Order | Administrator | 1 |
| Profit and Loss Statement | Administrator | 1 |
| Program | Administrator | 1 |
| Project | Administrator | 1 |
| Projects | Administrator | 1 |
| Purchase Order | Administrator | 1 |
| Restaurant | Administrator | 1 |
| Room | Administrator | 1 |
| Sales Invoice | Administrator | 1 |
| Sales Order | Administrator | 1 |
| Selling | Administrator | 1 |
| Setup | Administrator | 1 |
| Soil Analysis | Administrator | 1 |
| Soil Texture | Administrator | 1 |
| Stock | Administrator | 1 |
| Student | Administrator | 1 |
| Student Applicant | Administrator | 1 |
| Student Attendance Tool | Administrator | 1 |
| Student Group | Administrator | 1 |
| Supplier | Administrator | 1 |
| Support | Administrator | 1 |
| Task | Administrator | 1 |
| Timesheet | Administrator | 1 |
| ToDo | Administrator | 1 |
| Volunteer | Administrator | 1 |
| Water Analysis | Administrator | 1 |
| Weather | Administrator | 1 |
| Website | Administrator | 1 |
±--------------------------±--------------±---------+
76 rows in set
Time: 0.028s

Yes sql skills are handy, to sort out your database to find out what your duplicate conflict is about.