RuntimeError - instructed to restart server for changing a file that I have not changed

Tags: #<Tag:0x00007f1141becd60>


I have been getting this for a while now when changing a controller in web/controllers/user_controller.ex

** (RuntimeError) could not compile application: myapp.

You must restart your server after changing the following config or lib files:

  * _build/dev/lib/myapp/.compile.lock

I didn’t change a lib or config file, so why do I have to restart?

I’m using Atom with the atom-elixir plugin, so I’m not sure if by hitting cmd+S if it writes to disk on all files (including some lib files maybe?)… Anyone else experiencing this?


I also see that almost every time (on many different projects) hitting save on a single file results in recompiling all dependencies, which seems crazy to me. Don’t know whats going on…


Can you try to reproduce that in an application so we can try to track down the issue? We should not track anything in _build, so it feels like it is either a configuration issue or something unexpected. What is your Phoenix version? Are you using umbrella apps?


Yeah I suspect it is something with my setup I just don’t know where to look for the issue. I will try it with a new Phoenix project tonight (using 1.2 with elixir 1.4).

It has been happening to me for some time so it’s hard to say what I’ve introduced to cause it.


Sorry I’m a little later than I expected. The compile lock error is more difficult to reproduce, as it seems to happen when I’m actually working the most, rather than if I try to replicate it…

So I was not able to reproduce anything with a brand new Phoenix project. But I do have an open source project that is recompiling all dependencies when any web or lib files changes. Here it is:

Every time the server is started up with mix phoenix.server (after having hit save on any file in the project, say the user controller mentioned below), it recompiles all dependencies.

I’ll keep trying to get a more reproducible set of steps for the compile lock issue.


I could not reproduce this. :frowning: Touching user_controller and then running mix phoenix.server recompiled only the user controller and not the whole app. I am using Elixir v1.4.1.

This is what I got from mix xref graph:

If A points to B, it means that A may be recompiled if B changes. If the edge has a (compile) note, then the recompilation is guaranteed. As you can see, nothing points to UserController, so changing it doesn’t recompile anything else.


Yeah I suspect like I said that it’s something in my setup that’s doing it. I’ll try again using a different editor and see if that makes an impact.


Under another project which is private I’m able to reproduce it by commenting and uncommenting an IO.inspect line in a file in the lib folder. I tried disabling this atom package and wasn’t able to reproduce it in the few minutes I was trying. After turning it back on I was able to reproduce the lock issue in under a minute or two. I’ll try leaving that package disabled longer to see if the issue is cleared up.

@msaraiva curious if you have any input…


So it is not the atom-elixir package :icon_sad: (sorry!)… I’m trying to disable one plugin at a time to see if I can find which one it is…

Is there no one else who has this problem?


I am also having the same problem. My app creates and saves files. After a file is created and if I reload a page on my site, I get the error “You must restart your server after changing the following config or lib files”.

I finally figured out the problem. It was because I was calling!(my_new_path) to change directory. I have created an issue