Error 500 when opening Issues connected to a deleted Milestone #958

Closed
opened 2025-11-02 03:43:16 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @ThomasBoettcherHolschen on GitHub (Aug 11, 2017).

  • Gitea version (or commit ref): 1.1.3
  • Git version: 2.12.3
  • Operating system: OpenSuse Leap 42.2
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Gitea Log:
2017/08/11 10:13:49 [...outers/repo/issue.go:461 ViewIssue()] [E] GetIssueByIndex: getMilestoneByRepoID [repo_id: 4, milestone_id: 4]: milestone does not exist [id: 4, repo_id: 4]
2017/08/11 10:13:49 [D] Template: status/500

XOrm Log:
2017/08/11 10:13:48 [I] [sql] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "passwd", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "description", "num_teams", "num_members", "diff_view_style" FROM "user" WHERE "id"=$1 LIMIT 1 [args] [1]
2017/08/11 10:13:48 [I] [sql] SELECT count(*) FROM "notification" WHERE user_id = $1 AND status = $2 [args] [1 1]
2017/08/11 10:13:48 [I] [sql] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "passwd", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "description", "num_teams", "num_members", "diff_view_style" FROM "user" WHERE "lower_name"=$1 LIMIT 1 [args] [el-cell]
2017/08/11 10:13:48 [I] [sql] SELECT "id", "owner_id", "lower_name", "name", "description", "website", "default_branch", "num_watches", "num_stars", "num_forks", "num_issues", "num_closed_issues", "num_pulls", "num_closed_pulls", "num_milestones", "num_closed_milestones", "is_private", "is_bare", "is_mirror", "is_fork", "fork_id", "created_unix", "updated_unix" FROM "repository" WHERE "owner_id"=$1 AND "lower_name"=$2 LIMIT 1 [args] [2 pat-ware]
2017/08/11 10:13:48 [I] [sql] SELECT "id", "user_id", "repo_id" FROM "watch" WHERE "user_id"=$1 AND "repo_id"=$2 LIMIT 1 [args] [1 4]
2017/08/11 10:13:48 [I] [sql] SELECT "id", "uid", "repo_id" FROM "star" WHERE "uid"=$1 AND "repo_id"=$2 LIMIT 1 [args] [1 4]
2017/08/11 10:13:48 [I] [sql] SELECT "id", "repo_id", "type", "index", "config", "created_unix" FROM "repo_unit" WHERE repo_id = $1 [args] [4]
2017/08/11 10:13:49 [I] [sql] SELECT "id", "repo_id", "index", "poster_id", "name", "content", "milestone_id", "priority", "assignee_id", "is_closed", "is_pull", "num_comments", "deadline_unix", "created_unix", "updated_unix" FROM "issue" WHERE "repo_id"=$1 AND "index"=$2 LIMIT 1 [args] [4 4]
2017/08/11 10:13:49 [I] [sql] SELECT "id", "owner_id", "lower_name", "name", "description", "website", "default_branch", "num_watches", "num_stars", "num_forks", "num_issues", "num_closed_issues", "num_pulls", "num_closed_pulls", "num_milestones", "num_closed_milestones", "is_private", "is_bare", "is_mirror", "is_fork", "fork_id", "created_unix", "updated_unix" FROM "repository" WHERE "id"=$1 LIMIT 1 [args] [4]
2017/08/11 10:13:49 [I] [sql] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "passwd", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "description", "num_teams", "num_members", "diff_view_style" FROM "user" WHERE "id"=$1 LIMIT 1 [args] [1]
2017/08/11 10:13:49 [I] [sql] SELECT * FROM "label" LEFT JOIN "issue_label" ON issue_label.label_id = label.id WHERE issue_label.issue_id = $1 ORDER BY "label"."name" ASC [args] [8]
2017/08/11 10:13:49 [I] [sql] SELECT "id", "repo_id", "name", "content", "is_closed", "num_issues", "num_closed_issues", "completeness", "deadline_unix", "closed_date_unix" FROM "milestone" WHERE "id"=$1 AND "repo_id"=$2 LIMIT 1 [args] [4 4]

Description

Create an Issue,
create a Milestone,
connect Issue and Milestone,
delete Milestone,
open Issue -> Error 500

Screenshots

error500gitea

Originally created by @ThomasBoettcherHolschen on GitHub (Aug 11, 2017). - Gitea version (or commit ref): 1.1.3 - Git version: 2.12.3 - Operating system: OpenSuse Leap 42.2 - Database (use `[x]`): - [X] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [X] No - [ ] Not relevant - Log gist: Gitea Log: 2017/08/11 10:13:49 [...outers/repo/issue.go:461 ViewIssue()] [E] GetIssueByIndex: getMilestoneByRepoID [repo_id: 4, milestone_id: 4]: milestone does not exist [id: 4, repo_id: 4] 2017/08/11 10:13:49 [D] Template: status/500 XOrm Log: 2017/08/11 10:13:48 [I] [sql] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "passwd", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "description", "num_teams", "num_members", "diff_view_style" FROM "user" WHERE "id"=$1 LIMIT 1 [args] [1] 2017/08/11 10:13:48 [I] [sql] SELECT count(*) FROM "notification" WHERE user_id = $1 AND status = $2 [args] [1 1] 2017/08/11 10:13:48 [I] [sql] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "passwd", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "description", "num_teams", "num_members", "diff_view_style" FROM "user" WHERE "lower_name"=$1 LIMIT 1 [args] [el-cell] 2017/08/11 10:13:48 [I] [sql] SELECT "id", "owner_id", "lower_name", "name", "description", "website", "default_branch", "num_watches", "num_stars", "num_forks", "num_issues", "num_closed_issues", "num_pulls", "num_closed_pulls", "num_milestones", "num_closed_milestones", "is_private", "is_bare", "is_mirror", "is_fork", "fork_id", "created_unix", "updated_unix" FROM "repository" WHERE "owner_id"=$1 AND "lower_name"=$2 LIMIT 1 [args] [2 pat-ware] 2017/08/11 10:13:48 [I] [sql] SELECT "id", "user_id", "repo_id" FROM "watch" WHERE "user_id"=$1 AND "repo_id"=$2 LIMIT 1 [args] [1 4] 2017/08/11 10:13:48 [I] [sql] SELECT "id", "uid", "repo_id" FROM "star" WHERE "uid"=$1 AND "repo_id"=$2 LIMIT 1 [args] [1 4] 2017/08/11 10:13:48 [I] [sql] SELECT "id", "repo_id", "type", "index", "config", "created_unix" FROM "repo_unit" WHERE repo_id = $1 [args] [4] 2017/08/11 10:13:49 [I] [sql] SELECT "id", "repo_id", "index", "poster_id", "name", "content", "milestone_id", "priority", "assignee_id", "is_closed", "is_pull", "num_comments", "deadline_unix", "created_unix", "updated_unix" FROM "issue" WHERE "repo_id"=$1 AND "index"=$2 LIMIT 1 [args] [4 4] 2017/08/11 10:13:49 [I] [sql] SELECT "id", "owner_id", "lower_name", "name", "description", "website", "default_branch", "num_watches", "num_stars", "num_forks", "num_issues", "num_closed_issues", "num_pulls", "num_closed_pulls", "num_milestones", "num_closed_milestones", "is_private", "is_bare", "is_mirror", "is_fork", "fork_id", "created_unix", "updated_unix" FROM "repository" WHERE "id"=$1 LIMIT 1 [args] [4] 2017/08/11 10:13:49 [I] [sql] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "passwd", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "description", "num_teams", "num_members", "diff_view_style" FROM "user" WHERE "id"=$1 LIMIT 1 [args] [1] 2017/08/11 10:13:49 [I] [sql] SELECT * FROM "label" LEFT JOIN "issue_label" ON issue_label.label_id = label.id WHERE issue_label.issue_id = $1 ORDER BY "label"."name" ASC [args] [8] 2017/08/11 10:13:49 [I] [sql] SELECT "id", "repo_id", "name", "content", "is_closed", "num_issues", "num_closed_issues", "completeness", "deadline_unix", "closed_date_unix" FROM "milestone" WHERE "id"=$1 AND "repo_id"=$2 LIMIT 1 [args] [4 4] ## Description Create an Issue, create a Milestone, connect Issue and Milestone, delete Milestone, open Issue -> Error 500 ## Screenshots ![error500gitea](https://user-images.githubusercontent.com/2284286/29205480-846ee88a-7e7d-11e7-9fb2-1d9fbda7712a.PNG)
GiteaMirror added the type/bug label 2025-11-02 03:43:16 -06:00
Author
Owner

@lunny commented on GitHub (Aug 11, 2017):

Have you tried that on https://try.gitea.io ?

@lunny commented on GitHub (Aug 11, 2017): Have you tried that on https://try.gitea.io ?
Author
Owner

@ThomasBoettcherHolschen commented on GitHub (Aug 11, 2017):

Yes, but I can't reproduce it there.

@ThomasBoettcherHolschen commented on GitHub (Aug 11, 2017): Yes, but I can't reproduce it there.
Author
Owner

@lunny commented on GitHub (Aug 11, 2017):

So maybe this has been fixed some PR which needed backport to v1.1

@lunny commented on GitHub (Aug 11, 2017): So maybe this has been fixed some PR which needed backport to v1.1
Author
Owner

@ThomasBoettcherHolschen commented on GitHub (Aug 11, 2017):

Ok, what can I do to get it fixed ? Seems like there is something wrong around this Function -> getMilestoneByRepoID ... It tries to load Milestone 4, that does not exist in the Postgres-DB... anymore.

@ThomasBoettcherHolschen commented on GitHub (Aug 11, 2017): Ok, what can I do to get it fixed ? Seems like there is something wrong around this Function -> getMilestoneByRepoID ... It tries to load Milestone 4, that does not exist in the Postgres-DB... anymore.
Author
Owner

@lunny commented on GitHub (Aug 12, 2017):

Keep this reopen until #1942 back ported to release/v1.1

@lunny commented on GitHub (Aug 12, 2017): Keep this reopen until #1942 back ported to release/v1.1
Author
Owner

@lunny commented on GitHub (Aug 13, 2017):

This has been fixed by #1942 and back ported to #2300

@lunny commented on GitHub (Aug 13, 2017): This has been fixed by #1942 and back ported to #2300
Author
Owner

@bkraul commented on GitHub (Apr 30, 2019):

This issue seems to persist in 1.8.0, and I do not even use milestones, so there is no deleted milestone. However, the log data is the same:

2019/04/29 18:30:05 [...src/reflect/value.go:447 call()] [E] GetMilestoneByID: 0: milestone does not exist [id: 0, repo_id: 0]
2019/04/29 19:08:11 [...src/reflect/value.go:447 call()] [E] GetMilestoneByID: 0: milestone does not exist [id: 0, repo_id: 0]
2019/04/29 21:55:22 [...routers/repo/pull.go:593 MergePullRequest()] [E] Merge: git rebase [/data/git/repositories/bkraul/icecream.git -> /data/gitea/tmp/local-repo/merge-542799724.git]: error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch

The web shows the same error 500.

@bkraul commented on GitHub (Apr 30, 2019): This issue seems to persist in 1.8.0, and I do not even use milestones, so there is no deleted milestone. However, the log data is the same: ``` 2019/04/29 18:30:05 [...src/reflect/value.go:447 call()] [E] GetMilestoneByID: 0: milestone does not exist [id: 0, repo_id: 0] 2019/04/29 19:08:11 [...src/reflect/value.go:447 call()] [E] GetMilestoneByID: 0: milestone does not exist [id: 0, repo_id: 0] 2019/04/29 21:55:22 [...routers/repo/pull.go:593 MergePullRequest()] [E] Merge: git rebase [/data/git/repositories/bkraul/icecream.git -> /data/gitea/tmp/local-repo/merge-542799724.git]: error: Failed to merge in the changes. hint: Use 'git am --show-current-patch' to see the failed patch ``` The web shows the same error 500.
Author
Owner

@lunny commented on GitHub (May 5, 2019):

It seems that's not related with milestone even it give two errors on log.

@lunny commented on GitHub (May 5, 2019): It seems that's not related with milestone even it give two errors on log.
Author
Owner

@bkraul commented on GitHub (May 5, 2019):

Try merging using the "Rebase and --no-ff option". After I disabled those and left only "Merge", it worked.

@bkraul commented on GitHub (May 5, 2019): Try merging using the "Rebase and --no-ff option". After I disabled those and left only "Merge", it worked.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#958