From 0812a9be37f955ebbd742df12d570e14c2e83dfc Mon Sep 17 00:00:00 2001 From: Daniel Samson <12231216+daniel-samson@users.noreply.github.com> Date: Sun, 12 Apr 2026 15:51:24 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20workspace=20deletion=20=E2=80=94=20use=20?= =?UTF-8?q?build=20transition=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The plain DELETE endpoint returns 405 for stopped workspaces. Use POST /workspaces/:id/builds with {"transition":"delete"} instead, which is the correct Coder API for workspace deletion. Co-Authored-By: Claude Opus 4.6 --- src/services/coder.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/coder.ts b/src/services/coder.ts index a690166..f3ae462 100644 --- a/src/services/coder.ts +++ b/src/services/coder.ts @@ -109,12 +109,14 @@ export class CoderClient { async deleteWorkspace(workspaceId: string): Promise { const res = await fetch( - `${this.baseUrl}/api/v2/workspaces/${workspaceId}`, + `${this.baseUrl}/api/v2/workspaces/${workspaceId}/builds`, { - method: "DELETE", + method: "POST", headers: { + "Content-Type": "application/json", "Coder-Session-Token": this.token, }, + body: JSON.stringify({ transition: "delete" }), }, );