{"record":{"id":"a04fe50320114d43","repo":"gastownhall/beads","slug":"issue-creation-reported-as-unsuccessful","errorCode":null,"errorMessage":"issue creation reported as unsuccessful","messagePattern":"issue creation reported as unsuccessful","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/linear/client.go","lineNumber":859,"sourceCode":"// CreateIssue creates a new issue in Linear.\nfunc (c *Client) CreateIssue(ctx context.Context, title, description string, priority int, stateID string, labelIDs []string) (*Issue, error) {\n\treq := &GraphQLRequest{\n\t\tQuery:     issueCreateMutation,\n\t\tVariables: map[string]interface{}{\"input\": c.buildIssueCreateInput(title, description, priority, stateID, labelIDs)},\n\t}\n\n\tdata, err := c.Execute(ctx, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create issue: %w\", err)\n\t}\n\n\tvar createResp IssueCreateResponse\n\tif err := json.Unmarshal(data, &createResp); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse create response: %w\", err)\n\t}\n\n\tif !createResp.IssueCreate.Success {\n\t\treturn nil, fmt.Errorf(\"issue creation reported as unsuccessful\")\n\t}\n\n\treturn &createResp.IssueCreate.Issue, nil\n}\n\n// createIssueSingleAttempt executes the issueCreate mutation exactly once,\n// without the retry loop used by Execute. This is intentional: retrying a\n// mutation that may have already reached Linear risks creating a duplicate.\n// The caller (CreateIssueIdempotent) handles retry safety by re-searching for\n// the idempotency marker after any failure.\nfunc (c *Client) createIssueSingleAttempt(ctx context.Context, title, description string, priority int, stateID string, labelIDs []string) (*Issue, error) {\n\treq := &GraphQLRequest{\n\t\tQuery:     issueCreateMutation,\n\t\tVariables: map[string]interface{}{\"input\": c.buildIssueCreateInput(title, description, priority, stateID, labelIDs)},\n\t}\n\n\tbody, err := json.Marshal(req)\n\tif err != nil {","sourceCodeStart":841,"sourceCodeEnd":877,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/linear/client.go#L841-L877","documentation":"Linear's issueCreate mutation returns a `success` boolean. If the mutation executed but Linear reported success=false (and no Execute/unmarshal error occurred), CreateIssue returns this error rather than an issue with a null/zero ID. It indicates the mutation was accepted but creation did not happen.","triggerScenarios":"Linear responds with issueCreate.success == false — typically due to business-rule rejections (e.g. invalid input slipping past validation), template/team constraints, or the account being over limits (e.g. issue limits on free plans).","commonSituations":"Workspace hitting plan limits, team requiring certain fields, input referencing archived teams/states that Linear accepts syntactically but rejects logically, unexpected API behavior after partial errors.","solutions":["Inspect the full GraphQL response for an `errors` array or detail messages accompanying success=false.","Validate the input against the team's requirements (required fields, limits) before calling CreateIssue.","Check the Linear workspace's plan/issue limits in the Linear admin UI.","Fall back to CreateIssueIdempotent, which retries safely and can surface better diagnostics."],"exampleFix":"// before\nif !createResp.IssueCreate.Success {\n    return nil, fmt.Errorf(\"issue creation reported as unsuccessful\")\n}\n// after\nif !createResp.IssueCreate.Success {\n    return nil, fmt.Errorf(\"issue creation reported as unsuccessful (lastError: %s)\", createResp.IssueCreate.LastError)\n}","handlingStrategy":"try-catch","validationCode":"// pre-check plan limits / required fields before creating\nissueCount, _ := countTeamIssues(ctx, client)\nif issueCount >= workspaceIssueLimit {\n    return errors.New(\"workspace issue limit reached; issueCreate would report success=false\")\n}","typeGuard":null,"tryCatchPattern":"issue, err := client.CreateIssue(ctx, title, desc, pri, stateID, labels)\nif err != nil {\n    if strings.Contains(err.Error(), \"reported as unsuccessful\") {\n        log.Printf(\"Linear rejected creation of %q; check workspace limits/required fields\", title)\n        return errCreateRejected\n    }\n    return err\n}","preventionTips":["Log the full GraphQL response whenever success=false to capture Linear's error details.","Monitor workspace plan limits if syncing large backlogs.","Ensure referenced teams/states are active, not archived.","Route creation through the idempotent path for better retry semantics."],"tags":["linear","graphql","mutation","api-response"],"backgroundTag":"mutation-rejected-by-api","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}