overleaf/overleaf · error · IOException
git gc error
Error message
git gc error
What it means
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.
Source
Thrown at services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/GitProjectRepo.java:133
Preconditions.checkState(repository.isPresent(), "Repo is not present");
File dir = getProjectDir();
Preconditions.checkState(dir.isDirectory());
Log.debug("[{}] Running git gc", projectName);
Process proc = new ProcessBuilder("git", "gc").directory(dir).start();
int exitCode;
try {
exitCode = proc.waitFor();
Log.debug("Exit: {}", exitCode);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
if (exitCode != 0) {
Log.warn("[{}] Git gc failed", dir.getAbsolutePath());
Log.warn(IOUtils.toString(proc.getInputStream(), StandardCharsets.UTF_8));
Log.warn(IOUtils.toString(proc.getErrorStream(), StandardCharsets.UTF_8));
throw new IOException("git gc error");
}
Log.debug("[{}] git gc successful", projectName);
}
@Override
public void deleteIncomingPacks() throws IOException {
Log.debug("[{}] Checking for garbage `incoming` files", projectName);
Files.walkFileTree(
getDotGitDir().toPath(),
new FileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
throws IOException {
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
File file_ = file.toFile();View on GitHub (pinned to 28ad3b03b7)
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
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/GitProjectRepo.java:133 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of overleaf/overleaf@28ad3b03b7 (2026-09-03).
Data as JSON: /api/errors/4e264b393e8ec309.
Report an issue: GitHub.