@@ -824,7 +824,6 @@ func AddSubIssue(ctx context.Context, client *github.Client, owner string, repo
824824
825825 // Success case
826826 if err == nil && resp .StatusCode == http .StatusCreated {
827- defer func () { _ = resp .Body .Close () }()
828827 r , err := json .Marshal (subIssue )
829828 if err != nil {
830829 return nil , fmt .Errorf ("failed to marshal response: %w" , err )
@@ -860,15 +859,16 @@ func AddSubIssue(ctx context.Context, client *github.Client, owner string, repo
860859
861860 // Handle non-201 status codes after retries exhausted
862861 if lastResp != nil && lastResp .StatusCode != http .StatusCreated {
863- defer func () { _ = lastResp .Body .Close () }()
864862 body , err := io .ReadAll (lastResp .Body )
863+ defer func () { _ = lastResp .Body .Close () }()
865864 if err != nil {
866865 return nil , fmt .Errorf ("failed to read response body: %w" , err )
867866 }
868867 return ghErrors .NewGitHubAPIStatusErrorResponse (ctx , "failed to add sub-issue" , lastResp , body ), nil
869868 }
870869
871- return nil , fmt .Errorf ("failed to add sub-issue after %d retries" , maxRetries )
870+ // This should not be reached in normal operation
871+ return nil , fmt .Errorf ("unexpected error: failed to add sub-issue" )
872872}
873873
874874func RemoveSubIssue (ctx context.Context , client * github.Client , owner string , repo string , issueNumber int , subIssueID int ) (* mcp.CallToolResult , error ) {
0 commit comments