Skip to content

Commit 6b94d65

Browse files
vsai12claude
andauthored
fix: clear error when Bytebase server predates 3.17.0 (#192)
* fix: clear error when Bytebase server predates 3.17.0 Bytebase 3.16.x servers emit a bare UUID in the actuator `workspace` field; since 3.17.0 the provider no longer prepends `workspaces/` to that value, so the bare UUID was forwarded as the IAM policy resource and the server rejected it with a cryptic `invalid workspace resource "<uuid>"` error. Fail fast at client init with an explicit version-mismatch message instead, matching how other Terraform providers handle backend version skew. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix: satisfy revive error-strings rule Drop the trailing period and restructure the multi-sentence error into a single sentence so the string no longer ends with punctuation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2fb691a commit 6b94d65

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

client/client.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,17 @@ func NewClient(url, email, password string) (api.Client, error) {
107107
if err != nil {
108108
return nil, errors.Wrapf(err, "failed to get actuator info")
109109
}
110-
c.workspaceName = actuatorResp.Msg.GetWorkspace()
111-
if c.workspaceName == "" {
110+
workspace := actuatorResp.Msg.GetWorkspace()
111+
if workspace == "" {
112112
return nil, errors.New("actuator returned empty workspace name; cannot initialize provider")
113113
}
114+
if !strings.HasPrefix(workspace, "workspaces/") {
115+
return nil, errors.Errorf(
116+
"legacy workspace value %q (expected %q); this provider version requires Bytebase >= 3.17.0, upgrade the server or pin the provider to \"~> 3.16\"",
117+
workspace, "workspaces/<id>",
118+
)
119+
}
120+
c.workspaceName = workspace
114121

115122
return &c, nil
116123
}

0 commit comments

Comments
 (0)