Error 500 creating PR with assignees #2042

Closed
opened 2025-11-02 04:22:04 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @lukas010 on GitHub (Jul 11, 2018).

  • Gitea version (or commit ref): bbf9abde49
  • Git version: 2.7.4
  • Operating system: Ubuntu 16.04.4 LTS
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes
    • No
    • Not relevant
  • Log gist:

Description

When I try to create pull request with one or more assignees I get 500 error. Error doesn't show up if nobody is assigned. I'm able to add assignees only for already existing pull requests.

Log error:

2018/07/10 15:41:42 [...routers/repo/pull.go:836 CompareAndPullRequestPost()] [E] NewPullRequest: newIssue: loadPullRequest: pull request does not exist [id: 0, issue_id: 24, head_repo_id: 0, base_repo_id: 0, head_branch: , base_branch: ]
Originally created by @lukas010 on GitHub (Jul 11, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): bbf9abde4937285c77154129ae9934b22b4ea7a6 - Git version: 2.7.4 - Operating system: Ubuntu 16.04.4 LTS - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes - [ ] No - [ ] Not relevant - Log gist: ## Description When I try to create pull request with one or more assignees I get 500 error. Error doesn't show up if nobody is assigned. I'm able to add assignees only for already existing pull requests. Log error: ``` 2018/07/10 15:41:42 [...routers/repo/pull.go:836 CompareAndPullRequestPost()] [E] NewPullRequest: newIssue: loadPullRequest: pull request does not exist [id: 0, issue_id: 24, head_repo_id: 0, base_repo_id: 0, head_branch: , base_branch: ] ```
GiteaMirror added the type/bug label 2025-11-02 04:22:04 -06:00
Author
Owner

@SagePtr commented on GitHub (Jul 29, 2018):

There is form of spaghetti in code:

First, newIssue is called. It creates new issue and puts it into database.
newIssue function calls ChangeAssignee for each assigner in created issue.
ChangeAssignee calls loadPullRequest to load pull request information (for supsequent webhook calls), but pull request is not ready yet.

I see two possible solutions:

  1. NewPullRequest should create new issue without assignees, then add pull request to database, and then add every assignee with changeAssignee function.
  2. changeAssignee should not enqueue webhooks calls for pull requests in the middle of creation (if corresponding record is not in database yet), but after successful PR record insertion NewPullRequest can loop through assignees and enqueue webhook call for each of them.

Both look like dirty workarounds for me, but if some of them is acceptible, implement it (or I could implement it, although i'm not golang coder, but syntax looks clear for me)

@SagePtr commented on GitHub (Jul 29, 2018): There is form of spaghetti in code: First, newIssue is called. It creates new issue and puts it into database. newIssue function calls ChangeAssignee for each assigner in created issue. ChangeAssignee calls loadPullRequest to load pull request information (for supsequent webhook calls), but pull request is not ready yet. I see two possible solutions: 1. NewPullRequest should create new issue without assignees, then add pull request to database, and then add every assignee with changeAssignee function. 2. changeAssignee should not enqueue webhooks calls for pull requests in the middle of creation (if corresponding record is not in database yet), but after successful PR record insertion NewPullRequest can loop through assignees and enqueue webhook call for each of them. Both look like dirty workarounds for me, but if some of them is acceptible, implement it (or I could implement it, although i'm not golang coder, but syntax looks clear for me)
Author
Owner

@ptman commented on GitHub (Aug 17, 2018):

This seems to affect 1.5.0, why not backport?

@ptman commented on GitHub (Aug 17, 2018): This seems to affect 1.5.0, why not backport?
Author
Owner

@ptman commented on GitHub (Aug 17, 2018):

Ah, it was backported. Maybe this could be made clearer some way?

@ptman commented on GitHub (Aug 17, 2018): Ah, it was backported. Maybe this could be made clearer some way?
Author
Owner

@lafriks commented on GitHub (Aug 17, 2018):

Yes for backported issues milestone should be changed

@lafriks commented on GitHub (Aug 17, 2018): Yes for backported issues milestone should be changed
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2042