{"record":{"id":"9f40b66384a8ee2f","repo":"lionsoul2014/ip2region","slug":"parse-v4-cache-policy-w","errorCode":null,"errorMessage":"parse v4 cache policy: %w","messagePattern":"parse v4 cache policy: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"binding/golang/main.go","lineNumber":45,"sourceCode":"\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get executale: %w\", err)\n\t}\n\n\txdbPath := filepath.Join(filepath.Dir(filepath.Dir(filepath.Dir(binPath))), \"/data/\", fileName)\n\t_, err = os.Stat(xdbPath)\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\n\t// fmt.Printf(\"xdbPath=%s\\n\", xdbPath)\n\treturn xdbPath, nil\n}\n\nfunc createService(v4XdbPath string, v4CachePolicy string, v6XdbPath string, v6CachePolicy string) (*service.Ip2Region, error) {\n\t// try to create v4 config\n\tv4CPolicy, err := service.CachePolicyFromName(v4CachePolicy)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parse v4 cache policy: %w\", err)\n\t}\n\n\tv4DbPath, err := homedir.Expand(v4XdbPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Expand(`%s`): %s\", v4XdbPath, err)\n\t}\n\tv4Config, err := service.NewV4Config(v4CPolicy, v4DbPath, 1)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"NewV4Config: %w\", err)\n\t}\n\n\t// try to create v6 config\n\tv6Policy, err := service.CachePolicyFromName(v6CachePolicy)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parse v6 cache policy: %w\", err)\n\t}\n\n\tv6DbPath, err := homedir.Expand(v6XdbPath)","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/lionsoul2014/ip2region/blob/c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1/binding/golang/main.go#L27-L63","documentation":"Go service factory: service.CachePolicyFromName rejected the v4 cache policy string; accepted (case-insensitive) names are file/nocache, vectorindex/vindex/vindexcache and content/buffercache, anything else wraps this error.","triggerScenarios":"Thrown at binding/golang/main.go:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the accepted policy names: file/nocache, vectorindex/vindex/vindexcache, or content/buffercache","Validate the policy string against service.CachePolicyFromName at config-load time","Default to vectorIndex when the config value is absent"],"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"}