Migration from CodeCommit including PRs causes runtime error #14425

Closed
opened 2025-11-02 11:12:35 -06:00 by GiteaMirror · 13 comments
Owner

Originally created by @tfmm on GitHub (Apr 29, 2025).

Description

When trying to migrate a repository and PRs from codecommit, I consistently get this error:

2025/04/29 15:23:23 ...ices/task/migrate.go:48:func1() [E] PANIC during runMigrateTask[4] by DoerID[6] to RepoID[93] for OwnerID[6]: runtime error: invalid memory address or nil pointer dereference
Stacktrace: /usr/local/go/src/runtime/panic.go:262 (0x47bad8)
/usr/local/go/src/runtime/signal_unix.go:917 (0x47baa8)
/go/src/code.gitea.io/gitea/services/migrations/codecommit.go:194 (0x2733478)
/go/src/code.gitea.io/gitea/modules/migration/retry_downloader.go:174 (0x2170285)
/go/src/code.gitea.io/gitea/modules/migration/retry_downloader.go:37 (0x216f643)
/go/src/code.gitea.io/gitea/modules/migration/retry_downloader.go:173 (0x21701ce)
/go/src/code.gitea.io/gitea/services/migrations/migrate.go:386 (0x275e102)
/go/src/code.gitea.io/gitea/services/migrations/migrate.go:130 (0x275cb44)
/go/src/code.gitea.io/gitea/services/task/migrate.go:123 (0x2a45948)
/go/src/code.gitea.io/gitea/services/task/task.go:34 (0x2a46864)
/go/src/code.gitea.io/gitea/services/task/task.go:52 (0x2a46afa)
/go/src/code.gitea.io/gitea/modules/queue/workerqueue.go:250 (0x1f0d5c1)
/go/src/code.gitea.io/gitea/modules/queue/workergroup.go:103 (0x1f0c32d)
/go/src/code.gitea.io/gitea/modules/queue/workergroup.go:183 (0x1f0bcb8)
/usr/local/go/src/runtime/asm_amd64.s:1700 (0x482060)
2025/04/29 15:23:23 ...ices/task/migrate.go:60:func1() [E] runMigrateTask[4] by DoerID[6] to RepoID[93] for OwnerID[6] failed: PANIC whilst trying to do migrate task: runtime error: invalid memory address or nil pointer dereference

If I deselect the pull request option, the repository migrates, however I need the PRs.

Gitea Version

1.23.7

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Docker

How are you running Gitea?

Docker

Database

PostgreSQL

Originally created by @tfmm on GitHub (Apr 29, 2025). ### Description When trying to migrate a repository and PRs from codecommit, I consistently get this error: ``` 2025/04/29 15:23:23 ...ices/task/migrate.go:48:func1() [E] PANIC during runMigrateTask[4] by DoerID[6] to RepoID[93] for OwnerID[6]: runtime error: invalid memory address or nil pointer dereference Stacktrace: /usr/local/go/src/runtime/panic.go:262 (0x47bad8) /usr/local/go/src/runtime/signal_unix.go:917 (0x47baa8) /go/src/code.gitea.io/gitea/services/migrations/codecommit.go:194 (0x2733478) /go/src/code.gitea.io/gitea/modules/migration/retry_downloader.go:174 (0x2170285) /go/src/code.gitea.io/gitea/modules/migration/retry_downloader.go:37 (0x216f643) /go/src/code.gitea.io/gitea/modules/migration/retry_downloader.go:173 (0x21701ce) /go/src/code.gitea.io/gitea/services/migrations/migrate.go:386 (0x275e102) /go/src/code.gitea.io/gitea/services/migrations/migrate.go:130 (0x275cb44) /go/src/code.gitea.io/gitea/services/task/migrate.go:123 (0x2a45948) /go/src/code.gitea.io/gitea/services/task/task.go:34 (0x2a46864) /go/src/code.gitea.io/gitea/services/task/task.go:52 (0x2a46afa) /go/src/code.gitea.io/gitea/modules/queue/workerqueue.go:250 (0x1f0d5c1) /go/src/code.gitea.io/gitea/modules/queue/workergroup.go:103 (0x1f0c32d) /go/src/code.gitea.io/gitea/modules/queue/workergroup.go:183 (0x1f0bcb8) /usr/local/go/src/runtime/asm_amd64.s:1700 (0x482060) 2025/04/29 15:23:23 ...ices/task/migrate.go:60:func1() [E] runMigrateTask[4] by DoerID[6] to RepoID[93] for OwnerID[6] failed: PANIC whilst trying to do migrate task: runtime error: invalid memory address or nil pointer dereference ``` If I deselect the pull request option, the repository migrates, however I need the PRs. ### Gitea Version 1.23.7 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System Docker ### How are you running Gitea? Docker ### Database PostgreSQL
GiteaMirror added the topic/repo-migrationtype/bug labels 2025-11-02 11:12:35 -06:00
Author
Owner

@tfmm commented on GitHub (Apr 30, 2025):

Just tested on the 1.24.0 rc0, same behavior there.

@tfmm commented on GitHub (Apr 30, 2025): Just tested on the 1.24.0 rc0, same behavior there.
Author
Owner

@lunny commented on GitHub (May 1, 2025):

The target.SourceCommit maybe nil which means the head branch maybe deleted.

			Head: base.PullRequestBranch{
				Ref:      strings.TrimPrefix(*target.SourceReference, git_module.BranchPrefix),
				SHA:      *target.SourceCommit,
				RepoName: c.repoName,
			},
@lunny commented on GitHub (May 1, 2025): ~The `target.SourceCommit` maybe `nil` which means the head branch maybe deleted.~ ```go Head: base.PullRequestBranch{ Ref: strings.TrimPrefix(*target.SourceReference, git_module.BranchPrefix), SHA: *target.SourceCommit, RepoName: c.repoName, }, ```
Author
Owner

@tfmm commented on GitHub (May 1, 2025):

So PRs with the source branch deleted cannot be migrated? Is there a workaround to skip those or something so others can be?

@tfmm commented on GitHub (May 1, 2025): So PRs with the source branch deleted cannot be migrated? Is there a workaround to skip those or something so others can be?
Author
Owner

@tfmm commented on GitHub (May 1, 2025):

Also, I just went through the PRs, and all of the source branches still exist.

@tfmm commented on GitHub (May 1, 2025): Also, I just went through the PRs, and all of the source branches still exist.
Author
Owner

@lunny commented on GitHub (May 2, 2025):

Also, I just went through the PRs, and all of the source branches still exist.

But the panic was caused by from target.SourceCommit is nil.

@lunny commented on GitHub (May 2, 2025): > Also, I just went through the PRs, and all of the source branches still exist. But the panic was caused by from `target.SourceCommit` is `nil`.
Author
Owner

@tfmm commented on GitHub (May 2, 2025):

Is there a way to see which PR is throwing the error, we have over 100 PRs in this repo, many of which with several commits.

@tfmm commented on GitHub (May 2, 2025): Is there a way to see which PR is throwing the error, we have over 100 PRs in this repo, many of which with several commits.
Author
Owner

@tfmm commented on GitHub (May 8, 2025):

I just checked all of the PRs in codecommit, and they all have a Source Commit.

@tfmm commented on GitHub (May 8, 2025): I just checked all of the PRs in codecommit, and they all have a Source Commit.
Author
Owner

@lunny commented on GitHub (May 8, 2025):

I just checked all of the PRs in codecommit, and they all have a Source Commit.

That's weird.

@lunny commented on GitHub (May 8, 2025): > I just checked all of the PRs in codecommit, and they all have a Source Commit. That's weird.
Author
Owner

@tfmm commented on GitHub (May 9, 2025):

Any advice on what I can do or try to get this migration handled?

@tfmm commented on GitHub (May 9, 2025): Any advice on what I can do or try to get this migration handled?
Author
Owner

@lunny commented on GitHub (May 27, 2025):

Found the problem, it should be the blank description. I sent #34541 to resolve the problem.

@lunny commented on GitHub (May 27, 2025): Found the problem, it should be the blank description. I sent #34541 to resolve the problem.
Author
Owner

@tfmm commented on GitHub (Jun 6, 2025):

@lunny just wanted to confirm this was the fix, and running a container from the nightly release the migration works without issue. Thanks for solving this, I appreciate it!

@tfmm commented on GitHub (Jun 6, 2025): @lunny just wanted to confirm this was the fix, and running a container from the nightly release the migration works without issue. Thanks for solving this, I appreciate it!
Author
Owner

@tfmm commented on GitHub (Jun 6, 2025):

Ok, so I was mistaken, it appeared that everything migrated, however now when I try to open any of the PRs, they all 500 with: 2025/06/06 14:11:12 .../web/repo/issue_view.go:913:preparePullViewReviewAndMerge() [E] GetDefaultMergeMessage: object does not exist [id: refs/heads/Repo, rel_path: ] Would that be related to this, or should that be a separate GH issue?

@tfmm commented on GitHub (Jun 6, 2025): Ok, so I was mistaken, it appeared that everything migrated, however now when I try to open any of the PRs, they all 500 with: ```2025/06/06 14:11:12 .../web/repo/issue_view.go:913:preparePullViewReviewAndMerge() [E] GetDefaultMergeMessage: object does not exist [id: refs/heads/Repo, rel_path: ]``` Would that be related to this, or should that be a separate GH issue?
Author
Owner

@lunny commented on GitHub (Jun 6, 2025):

Please report another issue.

@lunny commented on GitHub (Jun 6, 2025): Please report another issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14425