Agent creation fails with 'failed to Lchown Dockerfile' error

This question originally came up in our Slack community and the thread has been consolidated here for long-term reference.

I’m trying to use the LiveKit CLI to create/deploy an agent, but I keep running into this error:

unable to create agent: build failed... failed to read dockerfile: failed to Lchown "/Dockerfile" for UID 509697352, GID 1452554610: lchown /Dockerfile: invalid argument

Others are getting the same issue: Can not deploy (lk agent create) on macos · Issue #725 · livekit/livekit-cli · GitHub

Any suggestions?

This is typically an issue with file ownership when the project is synced via cloud storage (iCloud, Dropbox, OneDrive) or has unusual file permissions.

Try running this command in your project directory:

sudo chown -R 1000:1000 ./

Alternatively, move your project folder out of cloud-synced locations to a local directory, then try the deployment again.