Codeberg/Community
54
325
Fork
You've already forked Community
12

non existent IssueIndex when migrating from GitHub #1944

Closed
opened 2025年05月20日 10:09:30 +02:00 by zerkman · 20 comments

Comment

Hello,

I'm trying to migrate this repo: https://github.com/zerkman/zest

The migration fails on import of issues, with this error message "comment references non existent IssueIndex 4"

Seems Issue index 4 references a pull request, not an issue.

Am I doing something wrong?

### Comment Hello, I'm trying to migrate this repo: https://github.com/zerkman/zest The migration fails on import of issues, with this error message "comment references non existent IssueIndex 4" Seems Issue index 4 references a pull request, not an issue. Am I doing something wrong?

Me too. In my case the issue doesn't exist (it was deleted long ago) and I have no idea what is referencing it.

Me too. In my case the issue doesn't exist (it was deleted long ago) and I have no idea what is referencing it.
Owner
Copy link

The error is created here

returnfmt.Errorf("comment references non existent IssueIndex %d",comment.IssueIndex)

when a comment is assigned to an issue that does not exist. When the issue is deleted, there should be no comment attached to it, I suppose? @tasket could you add more details about your case (the repo and the issue, and if you have an idea where it could be referenced, that as well).

Normally, the migration tool should know between pulls and issues. @zerkman could you try to reproduce on https://v12.next.forgejo.org/ to check if there is any difference? If yes, I'll forward this to the Forgejo team for closer investigation.

The error is created here https://codeberg.org/forgejo/forgejo/src/commit/39e6785da00ddd3f1f01f846aab8bf0a5c31f96b/services/migrations/gitea_uploader.go#L462 when a comment is assigned to an issue that does not exist. When the issue is deleted, there should be no comment attached to it, I suppose? @tasket could you add more details about your case (the repo and the issue, and if you have an idea where it could be referenced, that as well). Normally, the migration tool should know between pulls and issues. @zerkman could you try to reproduce on https://v12.next.forgejo.org/ to check if there is any difference? If yes, I'll forward this to the Forgejo team for closer investigation.

@fnetX The repo is at https://github.com/tasket/wyng-backup

The issue number is 35. I searched through issues, commits and pull requests for the reference but could not find any.

FWIW, I was able to complete migrations of that repo on two separate occasions in the past. And I'm sure those were performed after issue 35 was deleted.

@fnetX The repo is at https://github.com/tasket/wyng-backup The issue number is 35. I searched through issues, commits and pull requests for the reference but could not find any. FWIW, I was able to complete migrations of that repo on two separate occasions in the past. And I'm sure those were performed after issue 35 was deleted.
Author
Copy link

@fnetX wrote in #1944 (comment):

Normally, the migration tool should know between pulls and issues. @zerkman could you try to reproduce on https://v12.next.forgejo.org/ to check if there is any difference? If yes, I'll forward this to the Forgejo team for closer investigation.

I just tried, and the migration was successful. All issues and pull requests seem to have migrated correctly. Looking all good to me.

@fnetX wrote in https://codeberg.org/Codeberg/Community/issues/1944#issuecomment-5536571: > Normally, the migration tool should know between pulls and issues. @zerkman could you try to reproduce on https://v12.next.forgejo.org/ to check if there is any difference? If yes, I'll forward this to the Forgejo team for closer investigation. I just tried, and the migration was successful. All issues and pull requests seem to have migrated correctly. Looking all good to me.

@fnetX @zerkman It still gets snagged at the same point (image attached):

@fnetX @zerkman It still gets snagged at the same point (image attached):

I was able to complete the migration by switching to a classic gh access token that has more permissions.

I was able to complete the migration by switching to a classic gh access token that has more permissions.
Owner
Copy link

What did you use before? Do you know which permission was missing?

What did you use before? Do you know which permission was missing?
Author
Copy link

@tasket wrote in #1944 (comment):

I was able to complete the migration by switching to a classic gh access token that has more permissions.

I tried that, and it also worked. Thanks for the hint!

Previously I was using a fine grained token with default permissions.

@tasket wrote in https://codeberg.org/Codeberg/Community/issues/1944#issuecomment-5616128: > I was able to complete the migration by switching to a classic gh access token that has more permissions. I tried that, and it also worked. Thanks for the hint! Previously I was using a fine grained token with default permissions.

@zerkman The fine-grained token that triggered the migration error has:

Read-only access to public repositories.
Permissions
 0 permissions for none of your repositories 
 Account permissions
 7 selected
 User permissions permit access to resources under your personal GitHub account.
Overview
0 permissions for none of your repositories
7 Account permissions
 Events
 Access: Read-only
 Followers
 Access: Read-only
 GPG keys
 Access: Read-only
 Git SSH keys
 Access: Read-only
 Profile
 Access: Read and write
 Starring
 Access: Read-only
 Watching
 Access: Read-only

I thought that read-only access to public repos was enough.

The classic token has the following (the items not listed are de-selected):


repo
Full control of private repositories
 repo:status
 Access commit status
 repo_deployment
 Access deployment status
 public_repo
 Access public repositories
 repo:invite
 Access repository invitations
 security_events
 Read and write security events
write:packages
Upload packages to GitHub Package Registry
 read:packages
 Download packages from GitHub Package Registry
delete:packages
Delete packages from GitHub Package Registry
@zerkman The fine-grained token that triggered the migration error has: ``` Read-only access to public repositories. Permissions 0 permissions for none of your repositories Account permissions 7 selected User permissions permit access to resources under your personal GitHub account. Overview 0 permissions for none of your repositories 7 Account permissions Events Access: Read-only Followers Access: Read-only GPG keys Access: Read-only Git SSH keys Access: Read-only Profile Access: Read and write Starring Access: Read-only Watching Access: Read-only ``` I thought that read-only access to public repos was enough. The classic token has the following (the items not listed are de-selected): ``` repo Full control of private repositories repo:status Access commit status repo_deployment Access deployment status public_repo Access public repositories repo:invite Access repository invitations security_events Read and write security events write:packages Upload packages to GitHub Package Registry read:packages Download packages from GitHub Package Registry delete:packages Delete packages from GitHub Package Registry ```
Owner
Copy link

Hmm, it is definitely weird. It would help if someone could investigate which API calls require permission.

Hmm, it is definitely weird. It would help if someone could investigate which API calls require permission.

Seems like a more accurate error message would also help

Seems like a more accurate error message would also help
Author
Copy link

definitely a error message issue. at no point we get any feedback about missing permissions.

definitely a error message issue. at no point we get any feedback about missing permissions.
Member
Copy link

I have worked on reproducing this issue on a v11.0.3 test forgejo instance and here on codeberg.org. I created my own test repo with a signature of issues and PRs and comments as close as possible to the descriptions (even closed PRs and deleted issues that have been referenced).

I created several access tokens, including of course ones that have the same permissions as described by @tasket. I also tried migrating https://github.com/tasket/wyng-backup.git (using various access tokens).

I could not reproduce this issue.
So either some information is missing OR the issue has been fixed in the meantime. For me it would be interesting to know whether all migration items have been selected. Maybe there is some dependency between PRs and issues or so.

Some thoughts that came to me along the way:

  • Both repositories linked here are public (now)
  • I was able to migrate any publy repo, even with the most restrictive tokens
    • This makes me doubt that the token actually was the solution.
  • The only error I got was a 404 when trying to access my test repo after it was made private when using a token with insufficient permissions.

So if you have more info @tasket and @zerkman please let me know. :)
Otherwise I suggest to close this in 4 Weeks latest.

I have worked on reproducing this issue on a v11.0.3 test forgejo instance and here on codeberg.org. I created my own test repo with a signature of issues and PRs and comments as close as possible to the descriptions (even closed PRs and deleted issues that have been referenced). I created several access tokens, including of course ones that have the same permissions as described by @tasket. I also tried migrating https://github.com/tasket/wyng-backup.git (using various access tokens). I could not reproduce this issue. So either some information is missing OR the issue has been fixed in the meantime. For me it would be interesting to know whether all migration items have been selected. Maybe there is some dependency between PRs and issues or so. Some thoughts that came to me along the way: * Both repositories linked here are public (now) * I was able to migrate any publy repo, even with the most restrictive tokens * This makes me doubt that the token actually was the solution. * The only error I got was a 404 when trying to access my test repo after it was made private when using a token with insufficient permissions. So if you have more info @tasket and @zerkman please let me know. :) Otherwise I suggest to close this in 4 Weeks latest.

The only other thing I can think of is that I tried migrating with "Issues" being the only option selected and it still failed.

The only other thing I can think of is that I tried migrating with "Issues" being the only option selected and it still failed.
jerger added the due date 2025年08月22日 2025年07月23日 09:16:33 +02:00
Author
Copy link

My first issue happened when I was using a "fine grained" token with default settings unchanged. Probably the issue access problem came from that. Then I went successful using a classic token with access to issues enabled.

I do not know if something changed in the meantime, but at the time I lacked the proper instructions for the migration to go as smooth as it can be. So if now everything goes fine with all the default token settings, you can consider the issue closed. Otherwise there should be precise instructions available to help with the migrations.

Thank you @fnetX for the time you spent investigating the issue, and many thanks to all the Codeberg team for allowing such a great platform to exist.

My first issue happened when I was using a "fine grained" token with default settings unchanged. Probably the issue access problem came from that. Then I went successful using a classic token with access to issues enabled. I do not know if something changed in the meantime, but at the time I lacked the proper instructions for the migration to go as smooth as it can be. So if now everything goes fine with all the default token settings, you can consider the issue closed. Otherwise there should be precise instructions available to help with the migrations. Thank you @fnetX for the time you spent investigating the issue, and many thanks to all the Codeberg team for allowing such a great platform to exist.
Member
Copy link

Thanks @zerkman and @tasket! With these hints i could finally reproduce the problem. 🥳

Details

Platform: Codeberg.org
Migration Repo: https://github.com/PatDyn/some-test-repo.git
Migration Items: Issues

Of interest is: https://github.com/PatDyn/some-test-repo/issues/1
This issue has a back link from a PR comment but as the PR is not included in the migration items, the back link leads to nowhere. When including PRs in the migration items, the migration can be done successfully. <- I think this is a bug worth investigating.

Considering ATs:
I tried with different Access Tokens and got the the same results even for permissive ones. So let's forget about them for now.

Thanks @zerkman and @tasket! With these hints i could finally reproduce the problem. 🥳 **Details** Platform: Codeberg.org Migration Repo: https://github.com/PatDyn/some-test-repo.git Migration Items: Issues Of interest is: https://github.com/PatDyn/some-test-repo/issues/1 This issue has a back link from a PR comment but as the PR is not included in the migration items, the back link leads to nowhere. When including PRs in the migration items, the migration can be done successfully. <- I think this is a bug worth investigating. Considering ATs: I tried with different Access Tokens and got the the same results even for permissive ones. So let's forget about them for now.
Member
Copy link

PR for fixing this issue: forgejo/forgejo#8892

PR for fixing this issue: https://codeberg.org/forgejo/forgejo/pulls/8892

A fix on the Forgejo end just landed. It's not deployed on Codeberg's end yet, but that will likely happen over the next two weeks: forgejo/forgejo#8892

Closing for now.

A fix on the Forgejo end just landed. It's not deployed on Codeberg's end yet, but that will likely happen over the next two weeks: https://codeberg.org/forgejo/forgejo/pulls/8892 Closing for now.

Ran into this problem today, but the workaround (also migrating pull requests) worked.

Ran into this problem today, but the workaround (also migrating pull requests) worked.

The fix was deployed.

The fix was deployed.
jasewolf referenced this issue from a commit 2025年09月07日 10:49:17 +02:00
Sign in to join this conversation.
No Branch/Tag specified
main
No results found.
Labels
Clear labels
accessibility

Reduces accessibility and is thus a "bug" for certain user groups on Codeberg.
bug

Something is not working the way it should. Does not concern outages.
bug
infrastructure

Errors evidently caused by infrastructure malfunctions or outages
Codeberg

This issue involves Codeberg's downstream modifications and settings and/or Codeberg's structures.
contributions welcome

Please join the discussion and consider contributing a PR!
docs

No bug, but an improvement to the docs or UI description will help
duplicate

This issue or pull request already exists
enhancement

New feature
infrastructure

Involves changes to the server setups, use `bug/infrastructure` for infrastructure-related user errors.
legal

An issue directly involving legal compliance
licence / ToS

involving questions about the ToS, especially licencing compliance
please chill
we are volunteers

Please consider editing your posts and remember that there is a human on the other side. We get that you are frustrated, but it's harder for us to help you this way.
public relations

Things related to Codeberg's external communication
question

More information is needed
question
user support

This issue contains a clearly stated problem. However, it is not clear whether we have to fix anything on Codeberg's end, but we're helping them fix it and/or find the cause.
s/Forgejo

Related to Forgejo. Please also check Forgejo's issue tracker.
s/Forgejo/migration

Migration related issues in Forgejo
s/Pages

Issues related to the Codeberg Pages feature
s/Weblate

Issue is related to the Weblate instance at https://translate.codeberg.org
s/Woodpecker

Woodpecker CI related issue
security

involves improvements to the sites security
service

Add a new service to the Codeberg ecosystem (instead of implementing into Gitea)
upstream

An open issue or pull request to an upstream repository to fix this issue (partially or completely) exists (i.e. Gitea, Forgejo, etc.)
wontfix

Codeberg's current set of contributors are not planning to spend time on delegating this issue.
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
7 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

2025年08月22日

Dependencies

No dependencies set.

Reference
Codeberg/Community#1944
Reference in a new issue
Codeberg/Community
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?