{"record":{"id":"a553ef5d11bd36ce","repo":"theonedev/onedev","slug":"bad-object-type-0","errorCode":null,"errorMessage":"Bad object type {0}","messagePattern":"Bad object type (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java","lineNumber":1219,"sourceCode":"\t\t}\n\t\tcase Constants.OBJ_TREE: {\n\t\t\tr = new RevTree(id);\n\t\t\tr.flags |= PARSED;\n\t\t\tbreak;\n\t\t}\n\t\tcase Constants.OBJ_BLOB: {\n\t\t\tr = new RevBlob(id);\n\t\t\tr.flags |= PARSED;\n\t\t\tbreak;\n\t\t}\n\t\tcase Constants.OBJ_TAG: {\n\t\t\tfinal RevTag t = new RevTag(id);\n\t\t\tt.parseCanonical(this, getCachedBytes(t, ldr));\n\t\t\tr = t;\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tthrow new IllegalArgumentException(MessageFormat.format(\n\t\t\t\t\tJGitText.get().badObjectType, Integer.valueOf(type)));\n\t\t}\n\t\tobjects.add(r);\n\t\treturn r;\n\t}\n\n\tbyte[] getCachedBytes(RevObject obj) throws LargeObjectException,\n\t\t\tMissingObjectException, IncorrectObjectTypeException, IOException {\n\t\treturn getCachedBytes(obj, reader.open(obj, obj.getType()));\n\t}\n\n\tbyte[] getCachedBytes(RevObject obj, ObjectLoader ldr)\n\t\t\tthrows LargeObjectException, MissingObjectException, IOException {\n\t\ttry {\n\t\t\treturn ldr.getCachedBytes(5 * MB);\n\t\t} catch (LargeObjectException tooBig) {\n\t\t\ttooBig.setObjectId(obj);\n\t\t\tthrow tooBig;","sourceCodeStart":1201,"sourceCodeEnd":1237,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java#L1201-L1237","documentation":"RevWalk.parseAny/parseCommit-style entry points inspect the object type stored in the repository (commit, tree, blob, tag). When the object database returns a type constant outside the known set (0 or >4), the walk cannot build a RevObject for it and throws this IllegalArgumentException. This normally indicates a corrupt or non-standard object in the repository.","triggerScenarios":"Parsing an object id whose backing storage reports an unrecognized type constant, e.g. a corrupted loose object header, an object type added by a newer/exotic git implementation, or a pack containing malformed type bits.","commonSituations":"Repository corruption after disk failure or interrupted gc; reading repositories produced by tools that write non-standard object types; tests feeding fabricated ObjectIds into RevWalk.parseAny.","solutions":["Run 'git fsck --full' on the repository to locate and assess corrupt objects.","Restore the repository from backup or re-clone from a healthy remote.","Identify the offending object id from the message/context and repair or remove it.","If caused by a third-party writer, stop using that writer or upgrade JGit to one supporting the object type."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// detect corruption ahead of parsing\nStatus s = Git.open(repoDir).getRepository().fsck(); // or run `git fsck --full` via CLI","typeGuard":"Integer type = repo.open(id).getType();\nboolean known = type >= Constants.OBJ_COMMIT && type <= Constants.OBJ_TAG; // 1..4","tryCatchPattern":"try {\n    return walk.parseAny(id);\n} catch (IllegalArgumentException e) {\n    throw new RepositoryCorruptedException(\"Unrecognized object type for \" + id, e);\n}","preventionTips":["Run periodic 'git fsck' health checks on repositories","Re-clone or restore from backup when corruption is detected","Avoid writing objects with non-git tooling","Keep JGit updated for new object-type support"],"tags":["git","corruption","object-database"],"backgroundTag":"invalid-enum-value","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"}