{"record":{"id":"5de4f51866db72ab","repo":"JuliusBrussee/caveman","slug":"cacheengine-max-stable-prefix-bytes-must-be-withi","errorCode":null,"errorMessage":"cacheengine: max stable prefix bytes must be within 0..%d","messagePattern":"cacheengine: max stable prefix bytes must be within 0\\.\\.(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/engine.go","lineNumber":66,"sourceCode":"\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\n\t}\n\tresolver := config.ResolveProfile\n\tif resolver == nil {\n\t\tresolver = defaultProfile\n\t}\n\tdrivers := make(map[string]Driver, len(config.Drivers))","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/engine.go#L48-L84","documentation":"Raised by newEngine (behind New/NewChecked): Config.MaxStablePrefixBytes is negative or above maxConfiguredByteLimit. Bounds how much stable-prefix input the engine will retain for cache affinity; out-of-range values fail construction immediately.","triggerScenarios":"Thrown at cacheengine/engine.go:66 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set MaxStablePrefixBytes within 0..maxConfiguredByteLimit (the %d in the message)","Leave it at zero to accept the engine default","Use NewChecked to surface the error explicitly"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}