Scala sbt server lock "server is already bootstrapping" in CI
sbt starts a background server that holds a lock on the project. When a second sbt cannot acquire that lock, it reports that a server is already bootstrapping or running, usually a stale lock from a killed process.
What this error means
sbt fails to start with "sbt server is already bootstrapping" or "Could not get lock on ... project/target/active.json", and the job hangs or exits before any task runs.
[error] sbt server is already bootstrapping this project.
[error] If you believe this is in error, delete
[error] project/target/active.json
[error] and try again.Common causes
A previous sbt left a stale lock
An sbt process was killed (timeout, cancelled job) without releasing the server lock, so active.json still claims the project.
Two sbt invocations overlap
Concurrent steps or a re-entrant invocation start a second sbt against the same project directory while the first holds the lock.
How to fix it
Remove the stale lock file
Delete the server lock so the next sbt can take it, as the error message instructs.
rm -f project/target/active.json
sbt compileRun sbt without a persistent server
Disable the background server in CI so no lock survives between invocations.
sbt -Dsbt.server.autostart=false compileHow to prevent it
- Run one sbt invocation per project directory in a job.
- Disable the sbt server in CI where a persistent daemon adds no value.
- Clean
project/target/active.jsonif a previous job was cancelled.