Repository navigation
bug: The coder agent is unable to connect back when an external workspace is created for another user #30825
Copy link
Copy link
Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
When creating an external workspace for another user, the coder agent on the external node fails when connecting back to the coder server. The create command returns an error (see logs), but the workspace is created and I can retrieve the agent instructions (see logs). The CODER_AGENT_TOKEN is set correctly
When creating an external workspace for the logged in user, it works fine.
Relevant Log Output
# Creating the workspace
$ coder external-workspaces create username/demo --template=external -y
No preset applied.
Planning workspace...
=== ✔ Queued [0ms]
==> ⧗ Running
==> ⧗ Running
=== ✔ Running [16ms]
==> ⧗ Setting up
=== ✔ Setting up [120ms]
==> ⧗ Initializing Terraform Directory
=== ✔ Initializing Terraform Directory [1596ms]
==> ⧗ Detecting persistent resources
=== ✔ Detecting persistent resources [912ms]
==> ⧗ Cleaning Up
=== ✔ Cleaning Up [19ms]
┌──────────────────────────────────────────────────────┐
│ Workspace Preview │
├──────────────────────────────────────────────────────┤
│ RESOURCE ACCESS │
├──────────────────────────────────────────────────────┤
│ coder_external_agent.main │
│ └─ main (linux, arm64) coder ssh demo │
└──────────────────────────────────────────────────────┘
=== ✔ Queued [0ms]
==> ⧗ Running
==> ⧗ Running
=== ✔ Running [162ms]
==> ⧗ Setting up
=== ✔ Setting up [127ms]
==> ⧗ Initializing Terraform Directory
2026-10-15 05:55:36.096Z Initializing provider plugins found in the configuration...
2026-10-15 05:55:36.096Z Finding matching versions for provider: coder/coder, version_constraint: ">= 2.10.0"
2026-10-15 05:55:36.706Z Installing provider version: coder/coder v2.19.0...
2026-10-15 05:55:37.258Z Installed provider version: coder/coder v2.19.0 (signed by a HashiCorp partnerkey_id: 93C75807601AA0EC)
2026-10-15 05:55:37.258Z Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://developer.hashicorp.com/terraform/cli/plugins/signing
2026-10-15 05:55:37.258Z Initializing the backend...
2026-10-15 05:55:37.258Z Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
2026-10-15 05:55:37.258Z Terraform has been successfully initialized!
2026-10-15 05:55:37.259Z You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
=== ✔ Initializing Terraform Directory [1258ms]
==> ⧗ Planning Infrastructure
2026-10-15 05:55:37.494Z data.coder_workspace.me: Refreshing...
2026-10-15 05:55:37.496Z data.coder_workspace.me: Refresh complete after 0s [id=9a74e77f-69f9-4e68-9f33-825159695a02]
2026-10-15 05:55:37.508Z coder_agent.main: Plan to create
2026-10-15 05:55:37.508Z coder_external_agent.main: Plan to create
2026-10-15 05:55:37.508Z coder_app.code-server: Plan to create
2026-10-15 05:55:37.508Z Plan: 3 to add, 0 to change, 0 to destroy.
=== ✔ Planning Infrastructure [303ms]
==> ⧗ Starting workspace
2026-10-15 05:55:37.734Z Terraform 1.15.5
2026-10-15 05:55:37.802Z coder_agent.main: Plan to create
2026-10-15 05:55:37.803Z coder_external_agent.main: Plan to create
2026-10-15 05:55:37.803Z coder_app.code-server: Plan to create
2026-10-15 05:55:37.844Z coder_agent.main: Creating...
2026-10-15 05:55:37.846Z coder_agent.main: Creation complete after 0s [id=c7db025f-281e-4734-8c76-fbaacab2e96d]
2026-10-15 05:55:37.848Z coder_external_agent.main: Creating...
2026-10-15 05:55:37.849Z coder_external_agent.main: Creation complete after 0s [id=3c71e00d-eabd-48f7-9736-8746c83db3c8]
2026-10-15 05:55:37.849Z coder_app.code-server: Creating...
2026-10-15 05:55:37.851Z coder_app.code-server: Creation complete after 0s [id=77e6bcde-11c6-4e8b-8797-0b9cb54ff163]
2026-10-15 05:55:37.855Z Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
2026-10-15 05:55:37.855Z Outputs: 0
=== ✔ Starting workspace [547ms]
==> ⧗ Cleaning Up
=== ✔ Cleaning Up [24ms]
The demo workspace has been created at Oct 15 05:55:38!
Encountered an error running "coder external-workspaces create", see "coder external-workspaces create --help" for more information
error: Trace=[get workspace by name: ]
Resource not found or you do not have access to this resource
# Getting agent instructions
$ coder external-workspaces agent-instructions username/demo
Please run the following command to attach external agent to the workspace demo:
curl -fsSL "https://coder.removed.com/api/v2/init-script/linux/arm64" | CODER_AGENT_TOKEN="****" sh
# Agent log
Oct 15 05:59:13 external-node systemd[1]: Started coder-agent.service - Coder Workspace Agent.
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.410 [info] agent is starting now url={"Scheme":"https","Opaque":"","User":null,"Host":"coder.removed.com","Path":"","Fragment":"","RawQuery":"","RawPath":"","RawFragment":"","ForceQuery":false,"OmitHost":false} auth=token version=v2.37.4+1d24629
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.411 [info] process priority management not enabled (linux-only) env_var=CODER_PROC_PRIO_MGMT enabled="" os=linux
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.411 [info] agent devcontainer detection enabled
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.411 [debu] waiting for agent reinitialization instructions
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.411 [info] http server listening addr=127.0.0.1:6060 name=pprof
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.411 [info] http server listening addr=127.0.0.1:2112 name=prometheus
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.411 [info] socket.agentsocket-server: agent socket server started path=""
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.411 [debu] socket server started path=""
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.411 [info] boundary-log-proxy: boundary log proxy started socket_path=/tmp/boundary-audit.sock
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.411 [info] agent firewall log proxy server started socket_path=/tmp/boundary-audit.sock
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.411 [info] connecting to coderd
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.411 [info] http server listening addr=127.0.0.1:2113 name=debug
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.449 [erro] failed to wait for agent reinitialization instructions error="GET https://coder.removed.com/api/v2/workspaceagents/me/reinit?wait=true: unexpected status code 401: User is not active (status = \"dormant\"). Contact an admin to reactivate your account.: Try logging in using 'coder login'."
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.449 [warn] run exited with error ...
Oct 15 05:59:13 external-node coder[603554]: error= GET https://coder.removed.com/api/v2/workspaceagents/me/rpc?role=agent&version=2.10: unexpected status code 401: unexpected non-JSON response "": Try logging in using 'coder login'.
Oct 15 05:59:13 external-node coder[603554]: Error: no response body
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.611 [info] connecting to coderd
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.612 [debu] waiting for agent reinitialization instructions
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.624 [erro] failed to wait for agent reinitialization instructions error="GET https://coder.removed.com/api/v2/workspaceagents/me/reinit?wait=true: unexpected status code 401: User is not active (status = \"dormant\"). Contact an admin to reactivate your account.: Try logging in using 'coder login'."
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.641 [warn] run exited with error ...
Oct 15 05:59:13 external-node coder[603554]: error= GET https://coder.removed.com/api/v2/workspaceagents/me/rpc?role=agent&version=2.10: unexpected status code 401: unexpected non-JSON response "": Try logging in using 'coder login'.
Oct 15 05:59:13 external-node coder[603554]: Error: no response body
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.886 [debu] waiting for agent reinitialization instructions
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.899 [erro] failed to wait for agent reinitialization instructions error="GET https://coder.removed.com/api/v2/workspaceagents/me/reinit?wait=true: unexpected status code 401: User is not active (status = \"dormant\"). Contact an admin to reactivate your account.: Try logging in using 'coder login'."
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.904 [info] connecting to coderd
Oct 15 05:59:13 external-node coder[603554]: 2026-10-15 05:59:13.932 [warn] run exited with error ...
Oct 15 05:59:13 external-node coder[603554]: error= GET https://coder.removed.com/api/v2/workspaceagents/me/rpc?role=agent&version=2.10: unexpected status code 401: unexpected non-JSON response "": Try logging in using 'coder login'.
Oct 15 05:59:13 external-node coder[603554]: Error: no response body
Oct 15 05:59:14 external-node coder[603554]: 2026-10-15 05:59:14.324 [debu] waiting for agent reinitialization instructions
Oct 15 05:59:14 external-node coder[603554]: 2026-10-15 05:59:14.336 [erro] failed to wait for agent reinitialization instructions error="GET https://coder.removed.com/api/v2/workspaceagents/me/reinit?wait=true: unexpected status code 401: User is not active (status = \"dormant\"). Contact an admin to reactivate your account.: Try logging in using 'coder login'."
Oct 15 05:59:14 external-node coder[603554]: 2026-10-15 05:59:14.356 [info] connecting to coderd
Oct 15 05:59:14 external-node coder[603554]: 2026-10-15 05:59:14.386 [warn] run exited with error ...
Oct 15 05:59:14 external-node coder[603554]: error= GET https://coder.removed.com/api/v2/workspaceagents/me/rpc?role=agent&version=2.10: unexpected status code 401: unexpected non-JSON response "": Try logging in using 'coder login'.
Oct 15 05:59:14 external-node coder[603554]: Error: no response body
Oct 15 05:59:15 external-node coder[603554]: 2026-10-15 05:59:15.023 [debu] waiting for agent reinitialization instructions
Oct 15 05:59:15 external-node coder[603554]: 2026-10-15 05:59:15.035 [erro] failed to wait for agent reinitialization instructions error="GET https://coder.removed.com/api/v2/workspaceagents/me/reinit?wait=true: unexpected status code 401: User is not active (status = \"dormant\"). Contact an admin to reactivate your account.: Try logging in using 'coder login'."
Oct 15 05:59:15 external-node coder[603554]: 2026-10-15 05:59:15.072 [info] connecting to coderd
Oct 15 05:59:15 external-node coder[603554]: 2026-10-15 05:59:15.099 [warn] run exited with error ...
Oct 15 05:59:15 external-node coder[603554]: error= GET https://coder.removed.com/api/v2/workspaceagents/me/rpc?role=agent&version=2.10: unexpected status code 401: unexpected non-JSON response "": Try logging in using 'coder login'.
Oct 15 05:59:15 external-node coder[603554]: Error: no response body
Oct 15 05:59:16 external-node coder[603554]: 2026-10-15 05:59:16.146 [debu] waiting for agent reinitialization instructions
Oct 15 05:59:16 external-node coder[603554]: 2026-10-15 05:59:16.158 [erro] failed to wait for agent reinitialization instructions error="GET https://coder.removed.com/api/v2/workspaceagents/me/reinit?wait=true: unexpected status code 401: User is not active (status = \"dormant\"). Contact an admin to reactivate your account.: Try logging in using 'coder login'."
Oct 15 05:59:16 external-node coder[603554]: 2026-10-15 05:59:16.209 [info] connecting to coderd
Oct 15 05:59:16 external-node coder[603554]: 2026-10-15 05:59:16.237 [warn] run exited with error ...
Oct 15 05:59:16 external-node coder[603554]: error= GET https://coder.removed.com/api/v2/workspaceagents/me/rpc?role=agent&version=2.10: unexpected status code 401: unexpected non-JSON response "": Try logging in using 'coder login'.
Oct 15 05:59:16 external-node coder[603554]: Error: no response body
Oct 15 05:59:17 external-node coder[603554]: 2026-10-15 05:59:17.954 [debu] waiting for agent reinitialization instructions
Oct 15 05:59:17 external-node coder[603554]: 2026-10-15 05:59:17.966 [erro] failed to wait for agent reinitialization instructions error="GET https://coder.removed.com/api/v2/workspaceagents/me/reinit?wait=true: unexpected status code 401: User is not active (status = \"dormant\"). Contact an admin to reactivate your account.: Try logging in using 'coder login'."
Oct 15 05:59:18 external-node coder[603554]: 2026-10-15 05:59:18.033 [info] connecting to coderd
Oct 15 05:59:18 external-node coder[603554]: 2026-10-15 05:59:18.061 [warn] run exited with error ...
Oct 15 05:59:18 external-node coder[603554]: error= GET https://coder.removed.com/api/v2/workspaceagents/me/rpc?role=agent&version=2.10: unexpected status code 401: unexpected non-JSON response "": Try logging in using 'coder login'.
Oct 15 05:59:18 external-node coder[603554]: Error: no response body
Oct 15 05:59:20 external-node coder[603554]: 2026-10-15 05:59:20.872 [debu] waiting for agent reinitialization instructions
Oct 15 05:59:20 external-node coder[603554]: 2026-10-15 05:59:20.884 [erro] failed to wait for agent reinitialization instructions error="GET https://coder.removed.com/api/v2/workspaceagents/me/reinit?wait=true: unexpected status code 401: User is not active (status = \"dormant\"). Contact an admin to reactivate your account.: Try logging in using 'coder login'."
Oct 15 05:59:20 external-node coder[603554]: 2026-10-15 05:59:20.965 [info] connecting to coderd
Oct 15 05:59:20 external-node coder[603554]: 2026-10-15 05:59:20.996 [warn] run exited with error ...
Oct 15 05:59:20 external-node coder[603554]: error= GET https://coder.removed.com/api/v2/workspaceagents/me/rpc?role=agent&version=2.10: unexpected status code 401: unexpected non-JSON response "": Try logging in using 'coder login'.
Oct 15 05:59:20 external-node coder[603554]: Error: no response body
Oct 15 05:59:25 external-node coder[603554]: 2026-10-15 05:59:25.586 [debu] waiting for agent reinitialization instructions
Oct 15 05:59:25 external-node coder[603554]: 2026-10-15 05:59:25.599 [erro] failed to wait for agent reinitialization instructions error="GET https://coder.removed.com/api/v2/workspaceagents/me/reinit?wait=true: unexpected status code 401: User is not active (status = \"dormant\"). Contact an admin to reactivate your account.: Try logging in using 'coder login'."
Oct 15 05:59:25 external-node coder[603554]: 2026-10-15 05:59:25.695 [info] connecting to coderd
Oct 15 05:59:25 external-node coder[603554]: 2026-10-15 05:59:25.725 [warn] run exited with error ...
Oct 15 05:59:25 external-node coder[603554]: error= GET https://coder.removed.com/api/v2/workspaceagents/me/rpc?role=agent&version=2.10: unexpected status code 401: unexpected non-JSON response "": Try logging in using 'coder login'.
Oct 15 05:59:25 external-node coder[603554]: Error: no response bodyExpected Behavior
I expected it to work the same as when creating it for the logged in user
Steps to Reproduce
- create an external workspace for another user
- run the coder agent on the external node
Environment
- Host OS: Kubernetes deployment (v1.32.7)
- Coder version: v2.37.4
- External node: Ubuntu 24.04.5, arm64 (NVIDIA DGX Spark Version 7.6.0 (GNU/Linux 7.0.0-1019-nvidia aarch64))
Additional Context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
linear-code commentedon Oct 15, 2026
ENG-3468