Skip to content

"Directory for node run already exists" error

Description

When running marv run I sometimes get the following error:

$ marv run --collection=bags
2019-05-28 15:10:28,705 ERRO marv.store directory exists '/home/marv/site/store/pmrtcjkktewfnutpxkpzisjfla/.foo_section-1'

ERROR: Directory for node run already exists:
'/home/marv/site/store/pmrtcjkktewfnutpxkpzisjfla/.foo_section-1'
In case no other node run is in progress, this is a bug which you are kindly
asked to report, providing information regarding any previous, failed node runs.

Aborted!

When I run into this issue, I'll do the following workaround:

rm -Rf /home/marv/site/store/pmrtcjkktewfnutpxkpzisjfla/
mkdir /home/marv/site/store/pmrtcjkktewfnutpxkpzisjfla/
marv run --collection=bags

This time marv run will run successfully.

However, it would be better if I didn't had to repair this manually.

How to reproduce

After running into this bag several times, I finally figured out what how to reproduce this:

Open two consoles. Type in the first console the following:

marv run --collection=bags

Now kill the process in the second terminal:

pkill -f "/opt/marv/bin/marv run"

Now you can run marv run --collection=bags in the first terminal again and you will get the error.

A situation where this will happen in the real life is when you run marv run inside a container and that container gets restarted (at least this was the situation for me when I ran into this error).