{"record":{"id":"4e264b393e8ec309","repo":"overleaf/overleaf","slug":"git-gc-error","errorCode":null,"errorMessage":"git gc error","messagePattern":"git gc error","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/GitProjectRepo.java","lineNumber":133,"sourceCode":"    Preconditions.checkState(repository.isPresent(), \"Repo is not present\");\n    File dir = getProjectDir();\n    Preconditions.checkState(dir.isDirectory());\n    Log.debug(\"[{}] Running git gc\", projectName);\n    Process proc = new ProcessBuilder(\"git\", \"gc\").directory(dir).start();\n    int exitCode;\n    try {\n      exitCode = proc.waitFor();\n      Log.debug(\"Exit: {}\", exitCode);\n    } catch (InterruptedException e) {\n      throw new RuntimeException(e);\n    }\n    if (exitCode != 0) {\n      Log.warn(\"[{}] Git gc failed\", dir.getAbsolutePath());\n      Log.warn(IOUtils.toString(proc.getInputStream(), StandardCharsets.UTF_8));\n      Log.warn(IOUtils.toString(proc.getErrorStream(), StandardCharsets.UTF_8));\n      throw new IOException(\"git gc error\");\n    }\n    Log.debug(\"[{}] git gc successful\", projectName);\n  }\n\n  @Override\n  public void deleteIncomingPacks() throws IOException {\n    Log.debug(\"[{}] Checking for garbage `incoming` files\", projectName);\n    Files.walkFileTree(\n        getDotGitDir().toPath(),\n        new FileVisitor<Path>() {\n          @Override\n          public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)\n              throws IOException {\n            return FileVisitResult.CONTINUE;\n          }\n\n          @Override\n          public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)\n              throws IOException {\n            File file_ = file.toFile();","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/overleaf/overleaf/blob/28ad3b03b71cb4311decdcb55c36b33ec10d72db/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/GitProjectRepo.java#L115-L151","documentation":"Warning emitted in GitProjectRepo.runGC when the spawned 'git gc' process exits with a non-zero code — garbage collection failed on the project's bare git repository (corrupt objects, stale lock files, or disk exhaustion). The project directory path and process output are logged; repo size is not reclaimed until gc succeeds.","triggerScenarios":"Thrown at services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/GitProjectRepo.java:133 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the logged process output for the underlying git error (cannot lock, corrupt object)","Run 'git gc' manually in the project directory to reproduce and fix","Remove stale gc.log / *.lock files from the repo if a previous gc was interrupted","Check disk space and inode usage on the git-bridge storage volume"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"28ad3b03b71cb4311decdcb55c36b33ec10d72db","analyzedAt":"2026-09-03T02:10:22.807Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}