From c87365ba457c23bc1289adaa8fa99602fd98a544 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Fri, 11 Sep 2026 14:34:04 +0000 Subject: [PATCH 1/2] fix(coderd/x/chatd): clarify the no-workspace tool error message --- coderd/x/chatd/chatd.go | 2 +- coderd/x/chatd/store_chat_attachment.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coderd/x/chatd/chatd.go b/coderd/x/chatd/chatd.go index ee17c598257..824520e4cf1 100644 --- a/coderd/x/chatd/chatd.go +++ b/coderd/x/chatd/chatd.go @@ -623,7 +623,7 @@ func (c *turnWorkspaceContext) loadWorkspaceAgentLocked( } if !chatSnapshot.WorkspaceID.Valid { - return chatSnapshot, database.WorkspaceAgent{}, xerrors.New("no workspace is associated with this chat. Use the create_workspace tool to create one") + return chatSnapshot, database.WorkspaceAgent{}, xerrors.New("this tool requires a workspace and this chat does not have one. Use the create_workspace tool to create one") } if chatSnapshot.AgentID.Valid { diff --git a/coderd/x/chatd/store_chat_attachment.go b/coderd/x/chatd/store_chat_attachment.go index 2e8bd1f0acb..0c434dfcc65 100644 --- a/coderd/x/chatd/store_chat_attachment.go +++ b/coderd/x/chatd/store_chat_attachment.go @@ -35,7 +35,7 @@ func (p *Server) storeChatAttachment( data []byte, ) (chattool.AttachmentMetadata, error) { if !chatSnapshot.WorkspaceID.Valid { - return chattool.AttachmentMetadata{}, xerrors.New("no workspace is associated with this chat. Use the create_workspace tool to create one") + return chattool.AttachmentMetadata{}, xerrors.New("this tool requires a workspace and this chat does not have one. Use the create_workspace tool to create one") } storedName, mediaType, err := chatfiles.PrepareStoredFile(name, detectName, data) From 6855ec199684700ad51d5d4bd6789273e0d04d0f Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Fri, 11 Sep 2026 14:48:43 +0000 Subject: [PATCH 2/2] test(coderd/x/chatd): update assertion for the reworded no-workspace error --- coderd/x/chatd/store_chat_attachment_internal_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coderd/x/chatd/store_chat_attachment_internal_test.go b/coderd/x/chatd/store_chat_attachment_internal_test.go index 34c5d027d47..edefddb2ca6 100644 --- a/coderd/x/chatd/store_chat_attachment_internal_test.go +++ b/coderd/x/chatd/store_chat_attachment_internal_test.go @@ -159,7 +159,7 @@ func TestStoreChatAttachment_NoWorkspace(t *testing.T) { server := &Server{db: db} attachment, err := server.storeChatAttachment(context.Background(), database.Chat{}, "build.log", "build.log", []byte("build output")) - require.ErrorContains(t, err, "no workspace is associated") + require.ErrorContains(t, err, "this tool requires a workspace") require.Equal(t, chattool.AttachmentMetadata{}, attachment) }