{"record":{"id":"b1242014c0193fdd","repo":"JuliusBrussee/caveman","slug":"cacheengine-max-key-shards-must-be-within-0-d","errorCode":null,"errorMessage":"cacheengine: max key shards must be within 0..%d","messagePattern":"cacheengine: max key shards must be within 0\\.\\.(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/engine.go","lineNumber":60,"sourceCode":"\t\treturn &Engine{\n\t\t\tguard: cacheguard.New(), prefixSafety: newPrefixSafetyCache(8192),\n\t\t\tmaxKeyShards: 64, maxRequestBytes: defaultInputByteLimit, maxStablePrefixBytes: defaultInputByteLimit,\n\t\t\tresolveProfile: defaultProfile, drivers: map[string]Driver{}, configErr: err,\n\t\t}\n\t}\n\treturn engine\n}\n\n// NewChecked validates configuration at construction time. New preserves its\n// original one-result API but stores the same configuration error and makes all\n// operations fail closed.\nfunc NewChecked(config Config) (*Engine, error) {\n\treturn newEngine(config)\n}\n\nfunc newEngine(config Config) (*Engine, error) {\n\tif config.MaxKeyShards < 0 || config.MaxKeyShards > maxConfiguredKeyShards {\n\t\treturn nil, fmt.Errorf(\"cacheengine: max key shards must be within 0..%d\", maxConfiguredKeyShards)\n\t}\n\tif config.MaxRequestBytes < 0 || config.MaxRequestBytes > maxConfiguredByteLimit {\n\t\treturn nil, fmt.Errorf(\"cacheengine: max request bytes must be within 0..%d\", maxConfiguredByteLimit)\n\t}\n\tif config.MaxStablePrefixBytes < 0 || config.MaxStablePrefixBytes > maxConfiguredByteLimit {\n\t\treturn nil, fmt.Errorf(\"cacheengine: max stable prefix bytes must be within 0..%d\", maxConfiguredByteLimit)\n\t}\n\tmaxShards := config.MaxKeyShards\n\tif maxShards == 0 {\n\t\tmaxShards = 64\n\t}\n\tmaxRequestBytes := config.MaxRequestBytes\n\tif maxRequestBytes == 0 {\n\t\tmaxRequestBytes = defaultInputByteLimit\n\t}\n\tmaxStablePrefixBytes := config.MaxStablePrefixBytes\n\tif maxStablePrefixBytes == 0 {\n\t\tmaxStablePrefixBytes = defaultInputByteLimit","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/cacheengine/engine.go#L42-L78","documentation":"Error \"cacheengine: max key shards must be within 0..%d\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at cacheengine/engine.go:60 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set max key shards within the allowed range."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}