Error during migrate because of develop mode setting (I guess)

Team,

I am getting stuck during migration on the below error. I went to site_config.json and added “develop mode”: 1 but it did not help. I am actually on develop using bench switch-to-develop, but still facing the same issue. Can you help me please?

Updating frappe                     : [========================================]
Updating erpnext                    : [========================================]
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/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 206, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 33, in migrate
    sync_fixtures()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/fixtures.py", line 24, in sync_fixtures
    ignore_links=True, overwrite=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/page/data_import_tool/data_import_tool.py", line 95, in import_doc
    frappe.modules.import_file.import_file_by_path(f, data_import=True, force=True, pre_process=pre_process)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 54, in import_file_by_path
    import_doc(doc, force=force, data_import=data_import, pre_process=pre_process)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 122, in import_doc
    doc.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 212, in insert
    self.run_before_save_methods()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 710, in run_before_save_methods
    self.run_method("validate")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 661, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 839, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 822, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 655, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 37, in validate
    self.check_developer_mode()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 69, in check_developer_mode
    frappe.throw(_("Not in Developer Mode! Set in site_config.json or make 'Custom' DocType."))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 302, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red')
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 295, in msgprint
    _raise_exception()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 268, in _raise_exception
    raise raise_exception, encode(msg)
frappe.exceptions.ValidationError: Not in Developer Mode! Set in site_config.json or make 'Custom' DocType.
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/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/frappe/bench-repo/bench/commands/update.py", line 90, in _update
    patch_sites(bench_path=bench_path)
  File "/home/frappe/bench-repo/bench/utils.py", line 161, in patch_sites
    run_frappe_cmd('--site', 'all', 'migrate', bench_path=bench_path)
  File "/home/frappe/bench-repo/bench/utils.py", line 501, in run_frappe_cmd
    raise CommandFailedError(args)
bench.utils.CommandFailedError: ('--site', 'all', 'migrate')

Hi could you display your site config json file here ?

@Muthu, here it is:

{
 "db_name": "1bd3e0294d", 
 "db_password": "Y2NeAgz41EA2pYmV", 
 "developer_mode": 1, 
 "dropbox_access_key": "qm65kxxr6k8zilh", 
 "dropbox_secret_key": "wn1dbsdk390hsot", 
 "encryption_key": "zoZ8I0SbYS9lLHMG5YX4o5fjzYUAyICn12iJCojdhuY=", 
 "host_name": "http://104.236.25.212:80/", 
 "limits": {
  "space_usage": {
   "backup_size": 479.0, 
   "database_size": 142.84, 
   "files_size": 495.0, 
   "total": 1116.84
  }
 }, 
 "nginx_port": 80
}

@ahmed . Everything seems okay , I am not able to find out the issue , remove this [quote=“ahmed, post:3, topic:15507”]
“developer_mode”: 1,
[/quote]

and try running the below commands and check if everything is okay or not

bench set-config developer_mode 1

bench frappe --clear_cache

Hi @ahmed,

Did you add the DocType in fixtures ?

Thanks, Makarand

Hi @makarand_b, yes I did, then I started getting the errors. I went bake to hooks.py and I removed doctype from fixtures, but still getting the errors, I guess the damage was already done. Just noticed now that under the Fixtures folder in my app there is a doctype.json file, should I delete it and try to migrate again? I have a feeling that this will fix it.

Yes, you can delete the doctype.json file from fixtures directory.

@makarand_b, removing Doctype from fixtures in hooks.py, and deleting the doctype.json file from the fixtures folder fixed the issue. Thanks for pointing this out. Does this mean that I can’t export doctypes using Fixtures ?

@Muthu, thanks a lot of your very quick response. Turns out that the issue was not with developer mode itself.

1 Like

@ahmed,

Yes you can export the is Custom doctype using fixtures.

Thanks, Makarand

@makarand_b is possible to have an example on how to export is Custom doctype?

Same question here. Would be good to have the procedure referenced here.