Repository navigation
Description
Current Behavior
File sync fails to install the Mutagen agent on workspaces where the coder_agent resource has a dir property set to a directory other than $HOME.
The error:
I can see the agent was scp'd to $HOME/coder (repo location):
coder@upload-code-pastebin-dcbe:~$ grep -r mutagen-agent /home/coder/*
grep: /home/coder/coder/.mutagen-agentc8a65917-9e3a-40b6-9af9-947bfd9e27ac: binary file matches
Root Cause Investigation
This seems to be caused by an interaction between Coder Desktop's bundled Mutagen binary and the breaking change in coder/coder#21194, which made SFTP/SCP respect coder_agent.dir.
Prior to that PR, SCP landed files in $HOME while SSH sessions used dir. Mutagen's agent installation relied on SCP landing the binary in $HOME and then SSH executing it from $HOME. The original mismatch between SCP and SSH working directories was tracked in coder/coder#16568.
After the PR, both SCP and SSH now use dir. However, Mutagen appears to use an absolute $HOME-based path (/home/coder/.mutagen-agent<UUID>) when SCPing the binary, bypassing the dir setting. The SSH execution step then looks for the binary relative to dir (/home/coder/coder/), and the file isn't there.
SSHing into the workspace and running ls -la ~/.mutagen-agent* shows no files, confirming the binary never lands in $HOME.
Steps to Reproduce
- Use a Coder deployment running v2.30+ (which includes the SFTP/SCP dir change from PR #21194)
- Use a template that sets
dironcoder_agentto a non-home directory, e.g.:
resource "coder_agent" "dev" {
arch = "amd64"
os = "linux"
dir = "/home/coder/coder"
}(The dogfood "Write Coder on Coder" template does this)
- Open Coder Desktop -> File Sync
- Configure a sync session to the workspace
- Observe the error on "Installing agent..."
Expected Behavior
Mutagen installs its agent and file sync begins successfully, regardless of the coder_agent.dir setting.
Workaround
Unsetting coder_agent.dir fully works around this issue.
Environment
- Coder Desktop: v0.8.0 (macOS)
- Coder deployment: v2.30.1+ (dogfood, running main)
- Template: dogfood "Write Coder on Coder"
(dir = local.repo_dir -> /home/coder/coder) - Workspace: Linux (amd64)
Additional Context
- Original SCP/SSH mismatch issue: coder_agent dir property breaks Mutagen file sync from Windows coder#16568
- Breaking SFTP/SCP change: fix(agent/agentssh)!: use configured directory for SFTP connections coder#21194
Activity
mrabbani commentedon Mar 15, 2026
I am facing the same issue. Is there any update?
ofigma commentedon Mar 30, 2026
This is blocking a workflow I have in mind. Will this be fixed soon?
RoyGeorgeAda commentedon Apr 17, 2026
Any ETA on how soon this will be fixed? Quite annoying at this point in time during testing sessions where I need to transfer lot of files and need to scp them individually.
matifali commentedon May 14, 2026
As of Terraform Provider 2.17.0, a warning is now shown when coder_agent.dir is set to a value other than ~ or $HOME. This does not fix the underlying issue, but it should help prevent users from running into it.
The longer-term plan is to deprecate and remove coder_agent.dir, along with vscode and vscode-insiders in coder_agent.display_apps, since they depend on coder_agent.dir to open in the target path. For IDEs, the recommended approach is to use the modules from registry.coder.com, or define an explicit coder_app and use the IDE URL handler to open a folder.
Created a followup issue for deprecation: coder/terraform-provider-coder#509
fix(agent): install agent using an absolute remote path
fix(agent): install agent using an absolute remote path (#10)
coder commentedon Oct 9, 2026
Update: the underlying issue is now fixed. Coder Desktop bundles Mutagen v0.18.5, which installs its agent using an absolute path (coder/mutagen#10), so file sync works when
coder_agent.diror a dev containerworkspaceFolderis not$HOME.Update to:
The
dirdeprecation and plan-time warning were also reverted in coder/terraform-provider-coder#549 and will ship in the next provider release.Posted on behalf of @matifali