Back to Codeberg

Unexpected status code 410 Gone when migrating repo from Github to Codeberg #501

forgejo-contrib-forgejo-cli-issues-501.md

latest16.3 KB
Original Source

forgejo-contrib/forgejo-cli

Watch20

Star402

Fork

You've already forked forgejo-cli

51

CodeIssues 44Pull requests 8Releases 11Packages 2WikiActivity

Unexpected status code 410 Gone when migrating repo from Github to Codeberg #501

New issue

Closed

opened 2026-06-14 19:52:09 +02:00 by Fluffinity · 9 comments

Fluffinity commented 2026-06-14 19:52:09 +02:00

Contributor

Copy link

Expected Behavior

The repo should be migrated/mirrored

Actual Behavior

After outputting Migrating... the message Error: unexpected status code 410 Gone is received. This happens regardless of whether the service is explicitly set to github via the -s flag or not.

The location of the error, provided in the fj output is forgejo-cli-0.5.0/src/repo.rs:1409:20.

Steps to Reproduce

  1. Login to a Forgejo instance with the CLI (codeberg.org in this case)
  2. invoke fj repo migrate https://github.com/fluffinity/nvim-config.git nvim-config
  3. Observe the 410 status code

fj Version

text
fj v0.5.0
user agent: forgejo-cli/0.5.0 (https://codeberg.org/forgejo-contrib/forgejo-cli/)
build type: crates.io
    target: x86_64-unknown-linux-gnu

Forgejo Version

15.0.0-156-02d7aaa8+gitea-1.22.0

Code of Conduct

  • I agree to act in accordance with the CoC & AI Agreement.
  • This issue was not generated by an LLM, even in part.

Expected Behavior The repo should be migrated/mirrored ### Actual Behavior After outputting Migrating... the message Error: unexpected status code 410 Gone is received. This happens regardless of whether the service is explicitly set to github via the -s flag or not. The location of the error, provided in the fj output is forgejo-cli-0.5.0/src/repo.rs:1409:20. ### Steps to Reproduce 1. Login to a Forgejo instance with the CLI (codeberg.org in this case) 2. invoke fj repo migrate https://github.com/fluffinity/nvim-config.git nvim-config 3. Observe the 410 status code ### fj Version text fj v0.5.0 user agent: forgejo-cli/0.5.0 (https://codeberg.org/forgejo-contrib/forgejo-cli/) build type: crates.io target: x86_64-unknown-linux-gnu ### Forgejo Version 15.0.0-156-02d7aaa8+gitea-1.22.0 ### Code of Conduct - [x] I agree to act in accordance with the CoC & AI Agreement. - [x] This issue was not generated by an LLM, even in part.

Fluffinity added the Kind/Bug label 2026-06-14 19:52:09 +02:00

Fluffinity commented 2026-06-14 20:05:55 +02:00

Author

Contributor

Copy link

If I try to specify the host codeberg.org manually via the -H flag, I get a different error
Error: validation failed: You can not import from disallowed hosts.
This error occurs with and without the -s flag

If I try to specify the host codeberg.org manually via the -H flag, I get a different error Error: validation failed: You can not import from disallowed hosts. This error occurs with and without the -s flag

Fluffinity commented 2026-06-14 22:29:54 +02:00

Author

Contributor

Copy link

When I tried to manually create a repo via fj repo create nvim-config I also got the 410 code. Setting the host explicitly resolved this issue. So this seems to be an issue regarding forgejo-cli not using the correct URL for API usage. What is the default supposed to be if no explicit host is specified? So far I couldn't find anything conclusive in the wiki.

My expectation would have been that for the single configured forgejo instance would be used, if no host is otherwise specified. Another option would be to prompt for a selection of the instance to use, by the user. This makes sense if multiple instances have been configured for use with the CLI. Alternatively, this case of no host being specified should be handled directly in the CLI and give the user an error message in the likes of Please specify a host the repo should be created on. Only receiving the HTTP 410 error message itself is not useful in this context, as there are two possibly different services involved in the migration. Therefore I consider this issue relevant for #448 as well. At least this is something you can check for on your own, as this is known before the call to the repo_migrate method of the Forgejo API object.

When I tried to manually create a repo via fj repo create nvim-config I also got the 410 code. Setting the host explicitly resolved this issue. So this seems to be an issue regarding forgejo-cli not using the correct URL for API usage. What is the default supposed to be if no explicit host is specified? So far I couldn't find anything conclusive in the wiki. My expectation would have been that for the single configured forgejo instance would be used, if no host is otherwise specified. Another option would be to prompt for a selection of the instance to use, by the user. This makes sense if multiple instances have been configured for use with the CLI. Alternatively, this case of no host being specified should be handled directly in the CLI and give the user an error message in the likes of Please specify a host the repo should be created on. Only receiving the HTTP 410 error message itself is not useful in this context, as there are two possibly different services involved in the migration. Therefore I consider this issue relevant for #448 as well. At least this is something you can check for on your own, as this is known before the call to the repo_migrate method of the Forgejo API object.

Cyborus commented 2026-06-14 23:25:39 +02:00

Member

Copy link

What is the default supposed to be if no explicit host is specified?

It looks in the local repo's remotes to guess, and will ask you to specify one if it can't figure it out. My suspicion is that you have github.com as the currently configured remote, and since it doesn't actually verify that the remote is a Forgejo instance, it was trying to access Forgejo's API endpoints on GitHub.

> What is the default supposed to be if no explicit host is specified? It looks in the local repo's remotes to guess, and will ask you to specify one if it can't figure it out. My suspicion is that you have github.com as the currently configured remote, and since it doesn't actually verify that the remote is a Forgejo instance, it was trying to access Forgejo's API endpoints on GitHub.

Fluffinity commented 2026-06-15 14:41:12 +02:00

Author

Contributor

Copy link

So am I right by assuming that the -s flag is for specifying the service you want to create the new repo on? And that the -l and -t flags are for authenticating on this target service? In any case I'll be working on a PR to make it explicit, that migration only works from a Forgejo instance.

So am I right by assuming that the -s flag is for specifying the service you want to create the new repo on? And that the -l and -t flags are for authenticating on this target service? In any case I'll be working on a PR to make it explicit, that migration only works **from** a Forgejo instance.

Cyborus commented 2026-06-15 16:00:14 +02:00

Member

Copy link

No, the -s flag is to specify what type of service you are migrating from. It only supposed migrating to Forgejo.

No, the -s flag is to specify what type of service you are migrating *from*. It only supposed migrating *to* Forgejo.

Fluffinity commented 2026-06-15 16:02:11 +02:00

Author

Contributor

Copy link

Then the current behavior is even more confusing to me. Is it possible, that the API endpoint on Githubs end is just outdated?

Then the current behavior is even more confusing to me. Is it possible, that the API endpoint on Githubs end is just outdated?

Cyborus commented 2026-06-15 16:09:35 +02:00

Member

Copy link

If it is trying to access an API endpoint on GitHub like I suspect, then it is doing so mistakenly. It should only be accessing Forgejo's API.

If it is trying to access an API endpoint on GitHub like I suspect, then it is doing so mistakenly. It should only be accessing Forgejo's API.

Fluffinity commented 2026-06-15 16:11:18 +02:00

Author

Contributor

Copy link

Just tried curl'ing the /api/v1/repos/migrate endpoint on Github and get the 410. That method really seems to be gone

Just tried curl'ing the /api/v1/repos/migrate endpoint on Github and get the 410. That method really seems to be gone

👍 1

Fluffinity commented 2026-06-19 18:36:19 +02:00

Author

Contributor

Copy link

Tested it again with the current version on the main branch and migrating the repo works now. I consider this problem fixed

Tested it again with the current version on the main branch and migrating the repo works now. I consider this problem fixed

👍 1

Fluffinity closed this issue 2026-06-19 18:36:19 +02:00

Sign in to join this conversation.

No Branch/Tag specified

BranchesTags

main

renovate/lock-file-maintenance

renovate/serde-saphyr-0.x

docs/contributing

no-port-in-refspec

login/v16.next.forgejo.org

crates-io-publish

0.5.x

compile-time-fluent

0.4.x

localization-alias-demo

api_url_field

v0.5.0

v0.4.1

v0.4.0

v0.3.0

v0.2.0

v0.1.1

v0.1.0

v0.0.4

v0.0.3

v0.0.2

v0.0.1

Labels

Clear labels[ Kind/Breaking Breaking change that won't be backward compatible

](#)[ Kind/Bug Something is not working

](#)[ Kind/Design Discussion about UI/UX design

](#)[ Kind/Documentation Documentation changes

](#)[ Kind/Enhancement Improve existing functionality

](#)[ Kind/Feature New functionality

](#)[ Kind/Security This is security issue

](#)[ Kind/Testing Issue or pull request related to testing

](#)[ Kind/Upstream This is an issue with upstream software (Forgejo) that is probably not our fault

](#)

[ Priority

Critical The priority is critical

](#)[ Priority

High The priority is high

](#)[ Priority

Low The priority is low

](#)[ Priority

Medium The priority is medium

](#)

[ Reviewed

Confirmed Issue has been confirmed

](#)[ Reviewed

Duplicate This issue or pull request already exists

](#)[ Reviewed

Invalid Invalid issue

](#)[ Reviewed

Won't Fix This issue won't be fixed

](#)

[ Status

Abandoned Somebody has started to work on this but abandoned work

](#)[ Status

Blocked Something is blocking this issue or pull request

](#)[ Status

Need More Info Feedback is required to reproduce issue or to continue work

](#)

[ Suspicious

](#)

No labels Kind/Breaking Kind/Bug Kind/Design Kind/Documentation Kind/Enhancement Kind/Feature Kind/Security Kind/Testing Kind/Upstream [ Priority

Critical ](/forgejo-contrib/forgejo-cli/issues?labels=173012) [ Priority

High ](/forgejo-contrib/forgejo-cli/issues?labels=173013) [ Priority

Low ](/forgejo-contrib/forgejo-cli/issues?labels=173015) [ Priority

Medium ](/forgejo-contrib/forgejo-cli/issues?labels=173014) [ Reviewed

Confirmed ](/forgejo-contrib/forgejo-cli/issues?labels=173007) [ Reviewed

Duplicate ](/forgejo-contrib/forgejo-cli/issues?labels=173005) [ Reviewed

Invalid ](/forgejo-contrib/forgejo-cli/issues?labels=173006) [ Reviewed

Won't Fix ](/forgejo-contrib/forgejo-cli/issues?labels=173008) [ Status

Abandoned ](/forgejo-contrib/forgejo-cli/issues?labels=173011) [ Status

Blocked ](/forgejo-contrib/forgejo-cli/issues?labels=173010) [ Status

Need More Info ](/forgejo-contrib/forgejo-cli/issues?labels=173009) Suspicious

Milestone

Clear milestone

No items

No milestone

Projects

Clear projects

No items

No project

Assignees

Clear assignees

No assignees

2 participants

Notifications Subscribe

Due date

The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference

forgejo-contrib/forgejo-cli#501

WritePreview

Loading…

Add table

| Rows | | | Columns | |

CancelOK

Add a link

Url Description Hint: With a URL in your clipboard, you can paste directly into the editor to create a link.

CancelOK

CancelSave

Reference in a new issue

Repository

forgejo-contrib/forgejo-cli

Title

Body

Create issue

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?

No Yes