{"record":{"id":"914e5c85882260a5","repo":"lionsoul2014/ip2region","slug":"xdb-verify-w","errorCode":null,"errorMessage":"xdb verify: %w","messagePattern":"xdb verify: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"binding/golang/main.go","lineNumber":88,"sourceCode":"\t}\n\n\treturn service.NewIp2Region(v4Config, v6Config)\n}\n\nfunc createSearcher(dbPath string, cachePolicy string) (*xdb.Searcher, error) {\n\thandle, err := os.OpenFile(dbPath, os.O_RDONLY, 0600)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"open xdb file `%s`: %w\", dbPath, err)\n\t}\n\n\tdefer handle.Close()\n\n\t// verify the xdb file\n\t// @Note: do NOT call it every time you create a searcher since this will slow down the search response.\n\t// @see the util.Verify function for details.\n\terr = xdb.Verify(handle)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"xdb verify: %w\", err)\n\t}\n\n\t// auto-detect the ip version from the xdb header\n\theader, err := xdb.LoadHeader(handle)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load header from `%s`: %s\", dbPath, err)\n\t}\n\n\tversion, err := xdb.VersionFromHeader(header)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to detect IP version from `%s`: %s\", dbPath, err)\n\t}\n\n\tswitch cachePolicy {\n\tcase \"nil\", \"file\":\n\t\treturn xdb.NewWithFileOnly(version, dbPath)\n\tcase \"vectorIndex\":\n\t\tvIndex, err := xdb.LoadVectorIndexFromFile(dbPath)","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/lionsoul2014/ip2region/blob/c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1/binding/golang/main.go#L70-L106","documentation":"Go CLI helper: xdb.Verify failed while validating the xdb file's internal structure (header/index checksums) before creating a searcher; the wrapped error describes the specific integrity violation.","triggerScenarios":"Thrown at binding/golang/main.go:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-generate or re-download a non-corrupted xdb file","Check the file was fully transferred (compare size/hash)","Skip verify only if you accept the risk; verification is deliberately slow and optional in production paths"],"exampleFix":null,"handlingStrategy":"try-catch","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"}