{"record":{"id":"2833a772efee4ee0","repo":"lionsoul2014/ip2region","slug":"invalid-xdb-structure-version-header-version","errorCode":null,"errorMessage":"invalid xdb structure version `${header.version}`","messagePattern":"invalid xdb structure version `(.+?)`","errorType":"exception","errorClass":"XdbException","httpStatus":null,"severity":"error","filePath":"binding/java/src/main/java/org/lionsoul/ip2region/xdb/Version.java","lineNumber":68,"sourceCode":"        if (n.equals(\"V4\") || n.equals(\"IPV4\")) {\n            return IPv4;\n        } else if (n.equals(\"V6\") || n.equals(\"IPV6\")) {\n            return IPv6;\n        } else {\n            throw new Exception(\"invalid version name `\"+name+\"`\");\n        }\n    }\n\n    // parse the version from header\n    public static final Version fromHeader(Header header) throws XdbException {\n        // Old 2.0 structure with IPv4 supports ONLY.\n        if (header.version == Searcher.STRUCTURE_20) {\n            return IPv4;\n        }\n\n        // structure 3.0 after IPv6 supporting\n        if (header.version != Searcher.STRUCTURE_30) {\n            throw new XdbException(\"invalid xdb structure version `\"+header.version+\"`\");\n        }\n\n        if (header.ipVersion == IPv4VersionNo) {\n            return IPv4;\n        } else if (header.ipVersion == IPv6VersionNo) {\n            return IPv6;\n        } else {\n            throw new XdbException(\"invalid ip version number `\" + header.ipVersion + \"`\");\n        }\n    }\n\n    @Override public String toString() {\n        return String.format(\"{Id:%d, Name:%s, Bytes:%d, IndexSize: %d}\", id, name, bytes, segmentIndexSize);\n    }\n}","sourceCodeStart":50,"sourceCodeEnd":83,"githubUrl":"https://github.com/lionsoul2014/ip2region/blob/c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1/binding/java/src/main/java/org/lionsoul/ip2region/xdb/Version.java#L50-L83","documentation":"Java Version.fromHeader rejects the xdb header: the structure version field is neither 2.0 (IPv4-only legacy) nor 3.0 (IPv6-capable), so the file is not a recognized xdb database — typically a corrupt, truncated, or foreign file.","triggerScenarios":"Thrown at binding/java/src/main/java/org/lionsoul/ip2region/xdb/Version.java:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Regenerate or re-download a valid xdb produced by the current maker","Verify the file was not truncated in transfer (check size and header bytes)","Pass the correct file path instead of pointing at an unrelated binary"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1","analyzedAt":"2026-09-02T16:58:39.988Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}