I found that changing/touching the Guardfile breaks the guard run.
First run of “hanami server” → all works as expected.
Touching/changing the Guardfile leads to:
16:24:38 - WARN - Guardfile changed – _guard-core will exit.
16:24:38 - INFO - Using Guardfile at /home/…/hanami/Guardfile.
16:24:38 - INFO - Puma starting on port 2300 in development environment.
[45593] Puma starting in cluster mode…
[45593] * Puma version: 6.1.1 (ruby 3.2.0-p0) (“The Way Up”)
[45593] * Min threads: 5
[45593] * Max threads: 5
[45593] * Environment: development
[45593] * Master PID: 45593
[45593] * Workers: 2
[45593] * Restarts: () hot () phased
[45593] * Preloading application
/home/…/hanami/vendor/bundle/ruby/3.2.0/gems/puma-6.1.1/lib/puma/binder.rb:335:in `initialize’: Address already in use - bind(2) for “0.0.0.0” port 2300 (Errno::EADDRINUSE)
[…]
16:24:39 - INFO - Guard is now watching at ‘/home/…/hanami’
I then have to stop (Ctrl-C) the server process and restart it.
Pretty sure this is not a Hanami bug but somewhere in Puma or Guard. I could not find anything in Puma or Guard issues that explains it. But it affects new Hanami projects as well. Does anyone have an idea what causes this?