Skip to content

Repository broken with "500 Internal Server Error" after git push: "packfile not found" due to missing .idx files #38359

Description

@kevinh-coder

Gitea Version

1.26.2

What happened?

Description

Intermittently, after running a git push, a repository becomes completely unreachable and returns a 500 Internal Server Error on both the web UI and via API calls.

Upon inspecting the repository's data directory on the server, we found that new .pack files are being created, but their corresponding .idx files are completely missing.

Workaround / Current Solution

Manually restoring or regenerating the missing .idx files for the orphaned .pack files instantly resolves the 500 error, and the repository becomes fully functional again.

Logs

HTTPRequest [I] router: completed GET /api/v1/repos/MyOrganization/MyRepository/branches for 10.x.x.149:61146, 500 Internal Server Error in 58.3ms @ repo/branch.go:284(repo.ListBranches)
.../actions/commit_status.go:50:CreateCommitStatusForRunJobs() [E] Failed to create commit status for job 11565: GetCommit[62ee07a1a875bb00af489f68d8cfec64a27ecafb]: packfile not found
HTTPRequest [I] router: completed POST /api/actions/runner.v1.RunnerService/UpdateTask for 192.x.x.225:59804, 200 OK in 84.9ms @ :1(http.Handler.ServeHTTP-fm)
HTTPRequest [I] router: completed GET /MyOrganization/MyRepository/src/ for 10.x.x.149:50768, 303 See Other in 52.3ms @ web/web.go:1702(web.registerWebRoutes.func54.(*Router).Group.registerWebRoutes.func54.10.14)
services/context/repo.go:919:registerWebRoutes.RepoRefByType.87() [E] GetBranchCommit: packfile not found
HTTPRequest [I] router: completed GET /MyOrganization/MyRepository/info/refs?service=git-upload-pack for 10.x.x.169:65235, 401 Unauthorized in 1.6ms @ repo/githttp.go:454(repo.GetInfoRefs)
HTTPRequest [I] router: completed GET /MyOrganization/MyRepository/info/refs?service=git-upload-pack for 10.x.x.169:65235, 200 OK in 46.5ms @ repo/githttp.go:454(repo.GetInfoRefs)
HTTPRequest [I] router: completed GET /MyOrganization/MyRepository/info/refs?service=git-upload-pack for 10.x.x.230:54028, 401 Unauthorized in 1.9ms @ repo/githttp.go:454(repo.GetInfoRefs)
HTTPRequest [I] router: completed POST /MyOrganization/MyRepository/git-upload-pack for 10.x.x.169:65235, 200 OK in 48.1ms @ repo/githttp.go:432(repo.ServiceUploadPack)

How are you running Gitea?

Operating System: Windows Server
Deployment Method: Binary (installed directly on Windows Server as a service/executable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions