{"record":{"id":"78c7b8b370f01e89","repo":"lionsoul2014/ip2region","slug":"invalid-cache-policy-name-s","errorCode":null,"errorMessage":"invalid cache policy name `%s`","messagePattern":"invalid cache policy name `(.+?)`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"binding/golang/service/config.go","lineNumber":36,"sourceCode":"// @Author Lion <chenxin619315@gmail.com>\n// @Date   2025/12/03\n\nconst (\n\tNoCache     = 0\n\tVIndexCache = 1\n\tBufferCache = 2\n)\n\nfunc CachePolicyFromName(name string) (int, error) {\n\tswitch strings.ToLower(name) {\n\tcase \"file\", \"nocache\":\n\t\treturn NoCache, nil\n\tcase \"vectorindex\", \"vindex\", \"vindexcache\":\n\t\treturn VIndexCache, nil\n\tcase \"content\", \"buffercache\":\n\t\treturn BufferCache, nil\n\tdefault:\n\t\treturn NoCache, fmt.Errorf(\"invalid cache policy name `%s`\", name)\n\t}\n}\n\ntype Config struct {\n\tcachePolicy int\n\tipVersion   *xdb.Version\n\n\t// xdb file path\n\txdbPath string\n\theader  *xdb.Header\n\n\t// buffers\n\tvIndex  []byte\n\tcBuffer []byte\n\n\tsearchers int\n}\n","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/lionsoul2014/ip2region/blob/c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1/binding/golang/service/config.go#L18-L54","documentation":"Go service package: CachePolicyFromName hit its default case — the lowercased name matches none of the accepted cache policy aliases (file/nocache, vectorindex/vindex/vindexcache, content/buffercache).","triggerScenarios":"Thrown at binding/golang/service/config.go:36 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use an accepted policy name or alias","Validate policy names in configuration before constructing the service","Map unknown values to a documented default rather than passing them through"],"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"}