Crashed bench custom app recovery

Hi Guys,

I managed to develop a custom app but unfortunately my bench is somehow corrupted and i cannot start it anymore. Is there any way to recover my work (doctypes mostly) by copying them into new bench?

Regards!

Whats the error? Please share a traceback.

frappe@bp-erp:~/frappe-bench$ bench start
13:50:27 system           | web.1 started (pid=2373)
13:50:27 system           | redis_queue.1 started (pid=2380)
13:50:27 redis_queue.1    | 2399:M 21 Aug 13:50:27.631 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:50:27 redis_queue.1    |                 _._                                                  
13:50:27 redis_queue.1    |            _.-``__ ''-._                                             
13:50:27 redis_queue.1    |       _.-``    `.  `_.  ''-._           Redis 3.0.6 (00000000/0) 64 bit
13:50:27 redis_queue.1    |   .-`` .-```.  ```\/    _.,_ ''-._                                   
13:50:27 redis_queue.1    |  (    '      ,       .-`  | `,    )     Running in standalone mode
13:50:27 redis_queue.1    |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 11002
13:50:27 redis_queue.1    |  |    `-._   `._    /     _.-'    |     PID: 2399
13:50:27 redis_queue.1    |   `-._    `-._  `-./  _.-'    _.-'                                   
13:50:27 redis_queue.1    |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
13:50:27 redis_queue.1    |  |    `-._`-._        _.-'_.-'    |           http://redis.io        
13:50:27 redis_queue.1    |   `-._    `-._`-.__.-'_.-'    _.-'                                   
13:50:27 redis_queue.1    |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
13:50:27 redis_queue.1    |  |    `-._`-._        _.-'_.-'    |                                  
13:50:27 redis_queue.1    |   `-._    `-._`-.__.-'_.-'    _.-'                                   
13:50:27 redis_queue.1    |       `-._    `-.__.-'    _.-'                                       
13:50:27 redis_queue.1    |           `-._        _.-'                                           
13:50:27 redis_queue.1    |               `-.__.-'                                               
13:50:27 redis_queue.1    | 
13:50:27 redis_queue.1    | 2399:M 21 Aug 13:50:27.631 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
13:50:27 redis_queue.1    | 2399:M 21 Aug 13:50:27.631 # Server started, Redis version 3.0.6
13:50:27 redis_queue.1    | 2399:M 21 Aug 13:50:27.631 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13:50:27 redis_queue.1    | 2399:M 21 Aug 13:50:27.631 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
13:50:27 redis_queue.1    | 2399:M 21 Aug 13:50:27.631 * The server is now ready to accept connections on port 11002
13:50:27 system           | watch.1 started (pid=2372)
13:50:27 system           | worker_default.1 started (pid=2375)
13:50:27 system           | redis_cache.1 started (pid=2377)
13:50:27 redis_cache.1    | 2389:M 21 Aug 13:50:27.619 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:50:27 redis_cache.1    |                 _._                                                  
13:50:27 redis_cache.1    |            _.-``__ ''-._                                             
13:50:27 redis_cache.1    |       _.-``    `.  `_.  ''-._           Redis 3.0.6 (00000000/0) 64 bit
13:50:27 redis_cache.1    |   .-`` .-```.  ```\/    _.,_ ''-._                                   
13:50:27 redis_cache.1    |  (    '      ,       .-`  | `,    )     Running in standalone mode
13:50:27 redis_cache.1    |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 13002
13:50:27 redis_cache.1    |  |    `-._   `._    /     _.-'    |     PID: 2389
13:50:27 redis_cache.1    |   `-._    `-._  `-./  _.-'    _.-'                                   
13:50:27 redis_cache.1    |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
13:50:27 redis_cache.1    |  |    `-._`-._        _.-'_.-'    |           http://redis.io        
13:50:27 redis_cache.1    |   `-._    `-._`-.__.-'_.-'    _.-'                                   
13:50:27 redis_cache.1    |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
13:50:27 redis_cache.1    |  |    `-._`-._        _.-'_.-'    |                                  
13:50:27 redis_cache.1    |   `-._    `-._`-.__.-'_.-'    _.-'                                   
13:50:27 redis_cache.1    |       `-._    `-.__.-'    _.-'                                       
13:50:27 redis_cache.1    |           `-._        _.-'                                           
13:50:27 redis_cache.1    |               `-.__.-'                                               
13:50:27 redis_cache.1    | 
13:50:27 redis_cache.1    | 2389:M 21 Aug 13:50:27.619 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
13:50:27 redis_cache.1    | 2389:M 21 Aug 13:50:27.619 # Server started, Redis version 3.0.6
13:50:27 redis_cache.1    | 2389:M 21 Aug 13:50:27.619 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13:50:27 redis_cache.1    | 2389:M 21 Aug 13:50:27.619 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
13:50:27 redis_cache.1    | 2389:M 21 Aug 13:50:27.619 * The server is now ready to accept connections on port 13002
13:50:27 system           | worker_long.1 started (pid=2374)
13:50:27 system           | schedule.1 started (pid=2379)
13:50:27 system           | socketio.1 started (pid=2376)
13:50:27 system           | worker_short.1 started (pid=2385)
13:50:27 system           | redis_socketio.1 started (pid=2378)
13:50:27 redis_socketio.1 | 2406:M 21 Aug 13:50:27.660 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:50:27 redis_socketio.1 |                 _._                                                  
13:50:27 redis_socketio.1 |            _.-``__ ''-._                                             
13:50:27 redis_socketio.1 |       _.-``    `.  `_.  ''-._           Redis 3.0.6 (00000000/0) 64 bit
13:50:27 redis_socketio.1 |   .-`` .-```.  ```\/    _.,_ ''-._                                   
13:50:27 redis_socketio.1 |  (    '      ,       .-`  | `,    )     Running in standalone mode
13:50:27 redis_socketio.1 |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 12002
13:50:27 redis_socketio.1 |  |    `-._   `._    /     _.-'    |     PID: 2406
13:50:27 redis_socketio.1 |   `-._    `-._  `-./  _.-'    _.-'                                   
13:50:27 redis_socketio.1 |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
13:50:27 redis_socketio.1 |  |    `-._`-._        _.-'_.-'    |           http://redis.io        
13:50:27 redis_socketio.1 |   `-._    `-._`-.__.-'_.-'    _.-'                                   
13:50:27 redis_socketio.1 |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
13:50:27 redis_socketio.1 |  |    `-._`-._        _.-'_.-'    |                                  
13:50:27 redis_socketio.1 |   `-._    `-._`-.__.-'_.-'    _.-'                                   
13:50:27 redis_socketio.1 |       `-._    `-.__.-'    _.-'                                       
13:50:27 redis_socketio.1 |           `-._        _.-'                                           
13:50:27 redis_socketio.1 |               `-.__.-'                                               
13:50:27 redis_socketio.1 | 
13:50:27 redis_socketio.1 | 2406:M 21 Aug 13:50:27.660 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
13:50:27 redis_socketio.1 | 2406:M 21 Aug 13:50:27.660 # Server started, Redis version 3.0.6
13:50:27 redis_socketio.1 | 2406:M 21 Aug 13:50:27.660 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13:50:27 redis_socketio.1 | 2406:M 21 Aug 13:50:27.660 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
13:50:27 redis_socketio.1 | 2406:M 21 Aug 13:50:27.660 * The server is now ready to accept connections on port 12002
13:50:29 watch.1          | Usage: bench [OPTIONS] COMMAND [ARGS]...
13:50:29 watch.1          | 
13:50:29 watch.1          | Error: No such command "watch".
13:50:29 schedule.1       | Usage: bench [OPTIONS] COMMAND [ARGS]...
13:50:29 schedule.1       | 
13:50:29 worker_short.1   | Usage: bench [OPTIONS] COMMAND [ARGS]...
13:50:29 worker_short.1   | 
13:50:29 schedule.1       | Error: No such command "schedule".
13:50:29 worker_short.1   | Error: No such command "worker".
13:50:29 web.1            | Usage: bench [OPTIONS] COMMAND [ARGS]...
13:50:29 web.1            | 
13:50:29 web.1            | Error: No such command "serve".
13:50:29 system           | watch.1 stopped (rc=2)
13:50:29 system           | sending SIGTERM to redis_socketio.1 (pid 2378)
13:50:29 system           | sending SIGTERM to worker_long.1 (pid 2374)
13:50:29 system           | sending SIGTERM to redis_queue.1 (pid 2380)
13:50:29 system           | sending SIGTERM to web.1 (pid 2373)
13:50:29 system           | sending SIGTERM to schedule.1 (pid 2379)
13:50:29 system           | sending SIGTERM to worker_default.1 (pid 2375)
13:50:29 system           | sending SIGTERM to socketio.1 (pid 2376)
13:50:29 system           | sending SIGTERM to redis_cache.1 (pid 2377)
13:50:29 system           | sending SIGTERM to worker_short.1 (pid 2385)
13:50:29 redis_queue.1    | 2399:signal-handler (1503312629) Received SIGTERM scheduling shutdown...
13:50:29 redis_socketio.1 | 2406:signal-handler (1503312629) Received SIGTERM scheduling shutdown...
13:50:29 redis_cache.1    | 2389:signal-handler (1503312629) Received SIGTERM scheduling shutdown...
13:50:29 system           | worker_short.1 stopped (rc=-15)
13:50:29 system           | worker_long.1 stopped (rc=-15)
13:50:29 system           | worker_default.1 stopped (rc=-15)
13:50:29 system           | schedule.1 stopped (rc=-15)
13:50:29 system           | web.1 stopped (rc=-15)
13:50:29 system           | socketio.1 stopped (rc=-15)
13:50:30 redis_cache.1    | 2389:M 21 Aug 13:50:30.034 # User requested shutdown...
13:50:30 redis_cache.1    | 2389:M 21 Aug 13:50:30.034 # Redis is now ready to exit, bye bye...
13:50:30 system           | redis_cache.1 stopped (rc=-15)
13:50:30 redis_queue.1    | 2399:M 21 Aug 13:50:30.037 # User requested shutdown...
13:50:30 redis_queue.1    | 2399:M 21 Aug 13:50:30.038 # Redis is now ready to exit, bye bye...
13:50:30 system           | redis_queue.1 stopped (rc=-15)
13:50:30 redis_socketio.1 | 2406:M 21 Aug 13:50:30.068 # User requested shutdown...
13:50:30 redis_socketio.1 | 2406:M 21 Aug 13:50:30.069 # Redis is now ready to exit, bye bye...
13:50:30 system           | redis_socketio.1 stopped (rc=-15)
frappe@bp-erp:~/frappe-bench$

what is the output for bench --help

frappe@bp-erp:~/frappe-bench$ bench --help
Usage: [OPTIONS] COMMAND [ARGS]…

Bench manager for Frappe

Options:
–version
–help Show this message and exit.

Commands:
backup backup site
backup-all-sites backup all sites
config change bench configuration
disable-production Disables production environment for the…
download-translations Download latest translations
get-app clone an app from the internet and set it up…
init Create a new bench
new-app start a new app
new-site Create a new site in the bench
prepare-staging Prepare staging branch from develop branch
release Release app (internal to the Frappe team)
remote-reset-url Reset app remote url to frappe official
remote-set-url Set app remote url
remote-urls Show apps remote url
remove-app completely remove app from bench
renew-lets-encrypt Renew Let’s Encrypt certificate
restart Restart supervisor processes
retry-upgrade
set-default-site Set default site for bench
set-mariadb-host Set MariaDB host for bench
set-nginx-port Set nginx port for site
set-ssl-certificate Set ssl certificate path for site
set-ssl-key Set ssl certificate private key path for site
set-url-root Set url root for site
setup Setup bench
shell
src Prints bench source folder path, which can be…
start Start Frappe development processes
switch-to-branch Switch all apps to specified branch, or…
switch-to-develop Switch frappe and erpnext to develop branch
switch-to-master Switch frappe and erpnext to master branch
update Update bench
()

frappe@bp-erp:~/frappe-bench$

I tried backup-all-sites but i got “No module named frappe.utils”

have you made any changes to any frappe app file?

No, as far as i remember.
I’ll try to push my app to github and then pull it back to a new bench, maybe it’ll work.

It worked!
Thanks for you precious time!