assistant: recognise the API's other wording for a missing workspace id

The key-needs-a-workspace error arrived as 'must include the
anthropic-workspace-id header' and was reported as a bare 500 instead of
503 assistant_misconfigured naming the variable. Match the header name,
not the sentence around it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGcjxF1cNLcuwc3DAPcnfj
This commit is contained in:
2026-09-19 13:36:45 +05:30
parent 7021d5d2f5
commit 2835252bb3

View File

@@ -295,7 +295,10 @@ func (c *Client) workspace() string {
// a 400 buried in a log, while the user just sees "something went wrong at our
// end" - which is true and useless.
func NeedsWorkspace(err error) bool {
return err != nil && strings.Contains(err.Error(), "anthropic-workspace-id is required")
// The API has worded this two ways so far: "anthropic-workspace-id is
// required" and "must include the anthropic-workspace-id header". Match
// the header name, which is the part that will not be reworded.
return err != nil && strings.Contains(err.Error(), "anthropic-workspace-id")
}
func (c *Client) modelID() string {