Skip to content

Migration from CodeCommit including PRs causes runtime error #34320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tfmm opened this issue Apr 29, 2025 · 10 comments · Fixed by #34541
Closed

Migration from CodeCommit including PRs causes runtime error #34320

tfmm opened this issue Apr 29, 2025 · 10 comments · Fixed by #34541
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug
Milestone

Comments

@tfmm
Copy link

tfmm commented 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

@tfmm tfmm added the type/bug label Apr 29, 2025
@kemzeb kemzeb added the topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them label Apr 30, 2025
@tfmm
Copy link
Author

tfmm commented Apr 30, 2025

Just tested on the 1.24.0 rc0, same behavior there.

@lunny
Copy link
Member

lunny commented 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,
			},

@tfmm
Copy link
Author

tfmm commented 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
Copy link
Author

tfmm commented May 1, 2025

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

@lunny
Copy link
Member

lunny commented 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.

@tfmm
Copy link
Author

tfmm commented 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
Copy link
Author

tfmm commented May 8, 2025

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

@lunny
Copy link
Member

lunny commented May 8, 2025

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

That's weird.

@tfmm
Copy link
Author

tfmm commented May 9, 2025

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

@lunny
Copy link
Member

lunny commented May 27, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants