Error on migrating

Hi there,
I am getting an error while migrating dont know what it means,

user@User-ThinkPad-T400:~/frappe-bench$ bench --site erpnext.dev migrate
Migrating erpnext.dev
Updating frappe : [========================================]
Updating erpnext : [=================================== ]bad json: /home/user/frappe-bench/apps/erpnext/erpnext/schools/doctype/student/student.json
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, 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/user/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/user/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/user/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/user/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/user/frappe-bench/apps/frappe/frappe/commands/site.py”, line 209, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/user/frappe-bench/apps/frappe/frappe/migrate.py”, line 32, in migrate
frappe.model.sync.sync_all(verbose=verbose)
File “/home/user/frappe-bench/apps/frappe/frappe/model/sync.py”, line 19, in sync_all
sync_for(app, force, verbose=verbose)
File “/home/user/frappe-bench/apps/frappe/frappe/model/sync.py”, line 44, in sync_for
import_file_by_path(doc_path, force=force)
File “/home/user/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 36, in import_file_by_path
docs = read_doc_from_file(path)
File “/home/user/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 74, in read_doc_from_file
doc = json.loads(f.read())
File “/usr/lib/python2.7/json/init.py”, line 338, in loads
return _default_decoder.decode(s)
File “/usr/lib/python2.7/json/decoder.py”, line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python2.7/json/decoder.py”, line 382, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting property name: line 766 column 1 (char 16248)

Hi @Ujjawal

Explain in detail what you are trying to do and someone here can help you .

Thanks

i was trying to update bench.
but got the error some files are left to commit so i did git add -A and git commit -a -m’Message’
and got message to merge or something. in the same there was a suggestion to try git pull so did that. later again did bench update and got the same error as above.
Later restoring from a database and then migrating it getting that same error.

It seems , you have done few changes to the core modules of erpnext , which prevents you from migrating .

Run

cd /home/ommi/frappe-bench/apps/erpnext/

git status

You can view the changes you have made ,

if you need those changes run git add . or git stash

then git commit to commit those changes and try migrating .

Thanks

it states that you have no changes to commit.

Could you paste the output of the terminal when you run bench migrate ?

Thanks

The first post is the error

Seems there’s something wrong with the json, did you mean to make some changes?. Just run git reset --hard upstream/master inside eprnext folder to remove any accidental changes and then try updating again.

message is Head is now at branch
after that?

Run update again

It seems you have done something to this ,

I have a similar instance on my server so downloaded the apps folder from it and replaced with the apps folder on the local machine and then restored the system from the database.
This solved it.

1 Like

Hi there, @ragav
The thing i am facing now is when i tried to login into the system it raised an error frappe ldap auth missing so i tried to update the bench so got the following error during erpnext pulling.

INFO:bench.app:pulling erpnext
remote: Counting objects: 2081, done.
remote: Total 2081 (delta 1344), reused 1344 (delta 1344), pack-reused 737
Receiving objects: 100% (2081/2081), 3.41 MiB | 321.00 KiB/s, done.
Resolving deltas: 100% (1678/1678), completed with 470 local objects.
From GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)

  • branch develop → FETCH_HEAD
    25e62fc…38c1732 develop → upstream/develop
    CONFLICT (modify/delete): patches.txt deleted in 38c173230486bc085058b79f70e42f7394a15dd3 and modified in HEAD. Version HEAD of patches.txt left in tree.
    Auto-merging erpnext/setup/doctype/company/company.json
    CONFLICT (content): Merge conflict in erpnext/setup/doctype/company/company.json
    Auto-merging erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
    CONFLICT (content): Merge conflict in erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
    Auto-merging erpnext/hr/doctype/salary_structure/salary_structure.py
    CONFLICT (content): Merge conflict in erpnext/hr/doctype/salary_structure/salary_structure.py
    Auto-merging erpnext/hr/doctype/salary_structure/salary_structure.json
    CONFLICT (content): Merge conflict in erpnext/hr/doctype/salary_structure/salary_structure.json
    Auto-merging erpnext/hr/doctype/salary_structure/salary_structure.js
    CONFLICT (content): Merge conflict in erpnext/hr/doctype/salary_structure/salary_structure.js
    Auto-merging erpnext/hr/doctype/salary_slip/salary_slip.py
    CONFLICT (content): Merge conflict in erpnext/hr/doctype/salary_slip/salary_slip.py
    Auto-merging erpnext/hr/doctype/salary_slip/salary_slip.json
    CONFLICT (content): Merge conflict in erpnext/hr/doctype/salary_slip/salary_slip.json
    Auto-merging erpnext/hr/doctype/process_payroll/process_payroll.py
    Auto-merging erpnext/hr/doctype/process_payroll/process_payroll.json
    CONFLICT (content): Merge conflict in erpnext/hr/doctype/process_payroll/process_payroll.json
    Auto-merging erpnext/hr/doctype/hr_settings/hr_settings.json
    CONFLICT (content): Merge conflict in erpnext/hr/doctype/hr_settings/hr_settings.json
    Auto-merging erpnext/hr/doctype/employee/employee.json
    CONFLICT (content): Merge conflict in erpnext/hr/doctype/employee/employee.json
    Auto-merging erpnext/hr/doctype/employee/employee.js
    Auto-merging erpnext/accounts/doctype/journal_entry/journal_entry.json
    CONFLICT (content): Merge conflict in erpnext/accounts/doctype/journal_entry/journal_entry.json
    Automatic merge failed; fix conflicts and then commit the result.
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 9, in
    load_entry_point(‘bench==4.1.0’, ‘console_scripts’, ‘bench’)()
    File “/home/user/bench-repo/bench/cli.py”, line 40, in cli
    bench_command()
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 716, in call
    return self.main(*args, **kwargs)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 696, in main
    rv = self.invoke(ctx)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 534, in invoke
    return callback(*args, **kwargs)
    File “/home/user/bench-repo/bench/commands/update.py”, line 60, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
    File “/home/user/bench-repo/bench/commands/update.py”, line 76, in _update
    pull_all_apps(bench_path=bench_path)
    File “/home/user/bench-repo/bench/app.py”, line 140, in pull_all_apps
    remote=remote, branch=get_current_branch(app, bench_path=bench_path)), cwd=app_dir)
    File “/home/user/bench-repo/bench/utils.py”, line 127, in exec_cmd
    raise CommandFailedError(cmd)
    bench.utils.CommandFailedError: git pull upstream develop

Navigate to apps/erpnext/setup/doctype/company/company.json, there you will see the merge conflicts denoted with <<<<<<< in the file.

Resolve them and then git add . , git commit, and continue!

Do this wherever you get conflict .

Thanks