Internal Server Error upon creating new pre-initialized repository #1372

Closed
opened 2025-11-02 03:58:13 -06:00 by GiteaMirror · 11 comments
Owner

Originally created by @strk on GitHub (Dec 16, 2017).

As of bdf1856011 (1.3.0-dev) installed locally, creating a new repository and requesting to initialize it ends up returning a 500 internal server error.
Console outputs do not show anything interesting other than:

2017/12/16 21:42:59 [I] [SQL] INSERT INTO "action" ("user_id","op_type","act_user_id","repo_id","comment_id","is_deleted","ref_name","is_private","content","created_unix") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING "id" []interface {}{3, 1, 3, 2, 0, false, "", false, "", 1513456979}
2017/12/16 21:42:59 [I] [SQL] ROLL BACK
[Macaron] 2017-12-16 21:42:59: Completed /repo/create 500 Internal Server Error in 43.473658ms

Log shows:

2017/12/16 21:42:59 [...routers/repo/repo.go:123 handleCreateError()] [E] CreatePost: initRepository: initRepository: path already exists: /home/strk/gitea-repositories/strk/test.git

At the end of this, on the filesystem there's no such repository

Originally created by @strk on GitHub (Dec 16, 2017). As of bdf18560110ac642c196054be38729760a4bbc39 (1.3.0-dev) installed locally, creating a new repository and requesting to initialize it ends up returning a 500 internal server error. Console outputs do not show anything interesting other than: > 2017/12/16 21:42:59 [I] [SQL] INSERT INTO "action" ("user_id","op_type","act_user_id","repo_id","comment_id","is_deleted","ref_name","is_private","content","created_unix") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING "id" []interface {}{3, 1, 3, 2, 0, false, "", false, "", 1513456979} > 2017/12/16 21:42:59 [I] [SQL] ROLL BACK [Macaron] 2017-12-16 21:42:59: Completed /repo/create 500 Internal Server Error in 43.473658ms Log shows: > 2017/12/16 21:42:59 [...routers/repo/repo.go:123 handleCreateError()] [E] CreatePost: initRepository: initRepository: path already exists: /home/strk/gitea-repositories/strk/test.git At the end of this, on the filesystem there's no such repository
GiteaMirror added the issue/confirmedtype/bug labels 2025-11-02 03:58:13 -06:00
Author
Owner

@lunny commented on GitHub (Dec 20, 2017):

@strk @lafriks This should not be a bug. This issue indicates your database repo record was deleted but the file system repository was not.

@lunny commented on GitHub (Dec 20, 2017): @strk @lafriks This should not be a bug. This issue indicates your database repo record was deleted but the file system repository was not.
Author
Owner

@lafriks commented on GitHub (Dec 20, 2017):

@lunny but it should fail with normal error message not with internal server error

@lafriks commented on GitHub (Dec 20, 2017): @lunny but it should fail with normal error message not with internal server error
Author
Owner

@Larivact commented on GitHub (Jan 19, 2019):

This error can currently be reproduced with the demo site: https://try.gitea.io/repo/create

@Larivact commented on GitHub (Jan 19, 2019): This error can currently be reproduced with the demo site: https://try.gitea.io/repo/create
Author
Owner

@zeripath commented on GitHub (Jan 19, 2019):

hmm... @Larivact how did you replicate this on try?

@zeripath commented on GitHub (Jan 19, 2019): hmm... @Larivact how did you replicate this on try?
Author
Owner

@zeripath commented on GitHub (Jan 19, 2019):

I think I agree with @lafriks though - it shouldn't be a 500, we should probably handle this more nicely and just adopt the repository informing the user.

@zeripath commented on GitHub (Jan 19, 2019): I think I agree with @lafriks though - it shouldn't be a 500, we should probably handle this more nicely and just adopt the repository informing the user.
Author
Owner

@Larivact commented on GitHub (Jan 19, 2019):

I created an account and attempted to create a repository entering just a name and checking Initialize Repository (Adds .gitignore, License and README).

@Larivact commented on GitHub (Jan 19, 2019): I created an account and attempted to create a repository entering just a name and checking `Initialize Repository (Adds .gitignore, License and README)`.
Author
Owner

@zeripath commented on GitHub (Jan 19, 2019):

@Larivact that's a very likely a different bug - this bug is specifically about the case where you have repositories already in your gitea-repositories directory and you are effectively trying to get gitea to adopt these new repos. Did you manage to do this on try? If so, please explain how you did this.

If not, you should open a new bug report for the issue you experienced, and try to tell us as much information about how you got the 500 as possible as I can't replicate this immediately at present.

@zeripath commented on GitHub (Jan 19, 2019): @Larivact that's a very likely a different bug - this bug is specifically about the case where you have repositories already in your gitea-repositories directory and you are effectively trying to get gitea to adopt these new repos. Did you manage to do this on try? If so, please explain how you did this. If not, you should open a new bug report for the issue you experienced, and try to tell us as much information about how you got the 500 as possible as I can't replicate this immediately at present.
Author
Owner

@lunny commented on GitHub (Jan 19, 2019):

@Larivact haven't reproduce on try.gitea.io, could you give more details?

@lunny commented on GitHub (Jan 19, 2019): @Larivact haven't reproduce on try.gitea.io, could you give more details?
Author
Owner

@Larivact commented on GitHub (Jan 19, 2019):

I apologize for commenting on the wrong issue. I encountered a different bug, for which I just opened #5772.

@Larivact commented on GitHub (Jan 19, 2019): I apologize for commenting on the wrong issue. I encountered a different bug, for which I just opened #5772.
Author
Owner

@stale[bot] commented on GitHub (Mar 20, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Mar 20, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@midacts commented on GitHub (Oct 27, 2019):

I ran into this today as well (I'm new to Gitea and it was my first repo).
I created a new repo and selected "Initialize Repository (Adds .gitignore, License and README)".

After selecting to create the repo i got a 500 error (as above).
After deleting the repo and not selecting that setting, it worked as intended.

@midacts commented on GitHub (Oct 27, 2019): I ran into this today as well (I'm new to Gitea and it was my first repo). I created a new repo and selected `"Initialize Repository (Adds .gitignore, License and README)"`. After selecting to create the repo i got a 500 error (as above). After deleting the repo and not selecting that setting, it worked as intended.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1372