{"record":{"id":"4cab9353af960bce","repo":"lionsoul2014/ip2region","slug":"failed-to-create-v4-config-w","errorCode":null,"errorMessage":"failed to create v4 config: %w","messagePattern":"failed to create v4 config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"binding/golang/service/ip2region.go","lineNumber":103,"sourceCode":"\n\t\tv6Pool:          v6Pool,\n\t\tv6InMemSearcher: v6InMemSearcher,\n\t}, nil\n}\n\n// create the ip2region search service with the specified v4 & v6 xdb path.\n// with default cache policy VIndexCache and default searchers = 20\nfunc NewIp2RegionWithPath(v4XdbPath string, v6XdbPath string) (*Ip2Region, error) {\n\tvar err error\n\n\t// create v4 config with default config items\n\tvar v4Config *Config\n\tif v4XdbPath == \"\" {\n\t\tv4Config = nil\n\t} else {\n\t\tv4Config, err = NewV4Config(VIndexCache, v4XdbPath, 20)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create v4 config: %w\", err)\n\t\t}\n\t}\n\n\t// create v6 config with default config items\n\tvar v6Config *Config\n\tif v6XdbPath == \"\" {\n\t\tv6Config = nil\n\t} else {\n\t\tv6Config, err = NewV6Config(VIndexCache, v6XdbPath, 20)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create v6 config: %w\", err)\n\t\t}\n\t}\n\n\treturn NewIp2Region(v4Config, v6Config)\n}\n\nfunc (ip2r *Ip2Region) Search(ip any) (string, error) {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/lionsoul2014/ip2region/blob/c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1/binding/golang/service/ip2region.go#L85-L121","documentation":"Go convenience constructor: building the default v4 config (open, verify, header/version check, vector-index load with 20 searchers) failed; the wrapped error pinpoints the failing step.","triggerScenarios":"Thrown at binding/golang/service/ip2region.go:103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error (verify, version match, index load)","Confirm the v4 xdb path points to a valid IPv4 database","Fix/regenerate the file and call NewIp2RegionWithPath again"],"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"}