{"record":{"id":"54038b6d8b5eb957","repo":"theonedev/onedev","slug":"s-project-id-d-ref-s","errorCode":null,"errorMessage":"%s (project id: %d, ref: %s)","messagePattern":"(.+?) \\(project id: (.+?), ref: (.+?)\\)","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"critical","filePath":"server-core/src/main/java/io/onedev/server/xodus/DefaultCommitInfoService.java","lineNumber":984,"sourceCode":"\t\t\t\t\tfor (Object work : works) {\n\t\t\t\t\t\tif (work instanceof CollectingWork) {\n\t\t\t\t\t\t\tcollectingWorks.add((CollectingWork) work);\n\t\t\t\t\t\t} else if (work instanceof CheckingWork) {\n\t\t\t\t\t\t\ttry (RevWalk revWalk = new RevWalk(projectService.getRepository(projectId))) {\n\t\t\t\t\t\t\t\tCollection<Ref> refs = new ArrayList<>();\n\t\t\t\t\t\t\t\trefs.addAll(projectService.getRepository(projectId).getRefDatabase()\n\t\t\t\t\t\t\t\t\t\t.getRefsByPrefix(Constants.R_HEADS));\n\t\t\t\t\t\t\t\trefs.addAll(projectService.getRepository(projectId).getRefDatabase()\n\t\t\t\t\t\t\t\t\t\t.getRefsByPrefix(Constants.R_TAGS));\n\n\t\t\t\t\t\t\t\tfor (Ref ref : refs) {\n\t\t\t\t\t\t\t\t\tRevObject revObj;\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\trevObj = revWalk.peel(revWalk.parseAny(ref.getObjectId()));\n\t\t\t\t\t\t\t\t\t} catch (MissingObjectException e) {\n\t\t\t\t\t\t\t\t\t\tvar message = String.format(\"%s (project id: %d, ref: %s)\", e.getMessage(),\n\t\t\t\t\t\t\t\t\t\t\t\tprojectId, ref.getName());\n\t\t\t\t\t\t\t\t\t\tthrow new ExplicitException(message);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (revObj instanceof RevCommit) {\n\t\t\t\t\t\t\t\t\t\tRevCommit commit = (RevCommit) revObj;\n\t\t\t\t\t\t\t\t\t\tcollectingWorks.add(new CollectingWork(CHECK_PRIORITY, commit.copy(),\n\t\t\t\t\t\t\t\t\t\t\t\tcommit.getCommitTime(), ref.getName()));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcollectingWorks.sort(new CommitTimeComparator());\n\n\t\t\t\t\tfor (CollectingWork work : collectingWorks)\n\t\t\t\t\t\tdoCollect(project, work.getCommitId(), work.getRefName());\n\t\t\t\t});\n\t\t\t}","sourceCodeStart":966,"sourceCodeEnd":1002,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/xodus/DefaultCommitInfoService.java#L966-L1002","documentation":"Thrown by DefaultCommitInfoService while walking refs during commit info collection: a ref points to an object id that is missing from the object database (MissingObjectException), which JGit wraps into an ExplicitException annotated with the project id and ref name. It indicates repository corruption — a dangling ref referencing a pruned or never-delivered object.","triggerScenarios":"A ref (branch/tag) in the project's git repository points to a commit/tree/blob that does not exist in the pack files or loose objects — typically after interrupted gc/prune, failed fetch replication, or manual object deletion.","commonSituations":"Disk-full or killed 'git gc' left refs without objects; repository migrated/copied incompletely; fetch/prune removed objects a stale ref still targets; corrupted storage after crash.","solutions":["Delete or fix the offending ref (git update-ref -d <ref>) then re-run the operation.","Run 'git fsck --full' on the project repository to enumerate all corruption.","Re-fetch from the canonical remote to restore missing objects.","Restore the repository from backup if corruption is extensive."],"exampleFix":"// before\ngit update-ref refs/heads/broken refs/heads/broken\n// after: remove ref pointing to missing object\ngit update-ref -d refs/heads/broken\ngit fetch origin '+refs/heads/*:refs/heads/*'","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { collectCommitInfo(projectId); } catch (ExplicitException e) { if (e.getMessage().contains(\"MissingObject\")) repairRepository(projectId); }","preventionTips":["Never interrupt git gc/prune; ensure adequate disk space","Schedule periodic git fsck checks on project repositories","Verify object completeness after repository migrations or backups"],"tags":["git","jgit","repository-corruption","missing-object"],"backgroundTag":"git-command-failed","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}