bytebase/bytebase · error
issue creation request failed
Error message
issue creation request failed
What it means
The MCP handleChange tool creates a Bytebase issue via the gRPC-gateway endpoint /bytebase.v1.IssueService/CreateIssue. When the underlying apiRequest returns an error (non-2xx response, network failure, or auth failure), it is wrapped as 'issue creation request failed' with the original cause attached.
Source
Thrown at backend/api/mcp/tool_change.go:443
// createIssue creates an issue linked to a plan.
func (s *Server) createIssue(ctx context.Context, project, title, planName, description string) (string, string, error) {
issue := map[string]any{
"title": title,
"type": "DATABASE_CHANGE",
"plan": planName,
}
if description != "" {
issue["description"] = description
}
body := map[string]any{
"parent": project,
"issue": issue,
}
resp, err := s.apiRequest(ctx, "/bytebase.v1.IssueService/CreateIssue", body)
if err != nil {
return "", "", errors.Wrap(err, "issue creation request failed")
}
if err := checkAPIResponse(resp, "create issues", "bb.issues.create"); err != nil {
return "", "", err
}
var result struct {
Name string `json:"name"`
ApprovalStatus string `json:"approvalStatus"`
}
if err := json.Unmarshal(resp.Body, &result); err != nil {
return "", "", errors.Wrap(err, "failed to parse CreateIssue response")
}
return result.Name, result.ApprovalStatus, nil
}
// createRollout creates a rollout for a plan.
func (s *Server) createRollout(ctx context.Context, planName string) (string, error) {
return s.callAPI(ctx, "/bytebase.v1.RolloutService/CreateRollout", "create rollouts", "bb.rollouts.create", map[string]any{View on GitHub (pinned to 1870550677)
Solutions
- Read the wrapped cause for the API's error message (often a permission or validation error)
- Verify the caller has bb.issues.create permission on the target project
- Validate the project resource name and issue payload (title, steps) match the current proto schema
- Re-authenticate if the credential may have expired
Example fix
// before
body := {"parent": "projects/typo-name", "issue": issue} // 404
// after
body := {"parent": "projects/actual-project-id", "issue": issue} // valid resource name
resp, err := s.apiRequest(ctx, "/bytebase.v1.IssueService/CreateIssue", body) Defensive patterns
Strategy: try-catch
Validate before calling
// verify permission and project before creating the issue
const allowed = await callTool('call_api', { operationId: 'bytebase.v1.ProjectService/GetProject', body: { name: project } });
if (allowed.status !== 200) throw new Error(`project ${project} not accessible`); Type guard
null
Try / catch
try {
result = await callTool('handleChange', { change: spec });
} catch (err) {
if (String(err).includes('issue creation request failed')) {
// inspect cause: check bb.issues.create permission, project name, payload schema
}
} Prevention
- Grant the caller bb.issues.create on the target project
- Validate project resource names against the live project list
- Keep payloads aligned with the current proto schema after upgrades
- Refresh credentials before long MCP sessions
When it happens
Trigger: CreateIssue call fails due to invalid issue payload (bad project resource name, invalid pipeline steps), insufficient IAM permission (missing bb.issues.create), expired credentials, or the server rejecting the request.
Common situations: Referencing a project the token can't access, malformed change/rollout specification in the issue body, API version drift changing required fields, or auth token expiry mid-session.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- failed to parse CreateIssue response
- failed to parse %s response
- %s failed: HTTP %d: %s
- operationId is required
- database is required
AI-assisted analysis of bytebase/bytebase@1870550677 (2026-09-06).
Data as JSON: /api/errors/94988ae317f85c7d.
Report an issue: GitHub.