{"record":{"id":"7303b037536b1af2","repo":"crowdsecurity/crowdsec","slug":"chunk-size-must-be-positive","errorCode":null,"errorMessage":"chunk_size must be positive","messagePattern":"chunk_size must be positive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/http/config.go","lineNumber":145,"sourceCode":"\t}\n\n\tif c.TLS != nil {\n\t\tif c.TLS.ServerCert == \"\" {\n\t\t\treturn errors.New(\"server_cert is required\")\n\t\t}\n\n\t\tif c.TLS.ServerKey == \"\" {\n\t\t\treturn errors.New(\"server_key is required\")\n\t\t}\n\t}\n\n\tif c.MaxBodySize != nil && *c.MaxBodySize <= 0 {\n\t\treturn errors.New(\"max_body_size must be positive\")\n\t}\n\n\t/*\n\t\tif hc.ChunkSize != nil && *hc.ChunkSize <= 0 {\n\t\t\treturn errors.New(\"chunk_size must be positive\")\n\t\t}\n\t*/\n\n\tif c.CustomStatusCode != nil {\n\t\tstatusText := http.StatusText(*c.CustomStatusCode)\n\t\tif statusText == \"\" {\n\t\t\treturn errors.New(\"invalid HTTP status code\")\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (s *Source) Configure(_ context.Context, yamlConfig []byte, logger *log.Entry, metricsLevel metrics.AcquisitionMetricsLevel) error {\n\ts.logger = logger\n\ts.metricsLevel = metricsLevel\n\n\terr := s.UnmarshalConfig(yamlConfig)","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/http/config.go#L127-L163","documentation":"The HTTP acquisition source validates that body/size configuration values are sane. A chunk_size (or max_body_size) of zero or negative is meaningless for reading a stream, so validation rejects it before the source is started. Note in the current source the chunk_size check itself is commented out in pkg/acquisition/modules/http/config.go:145, so this message is only thrown by builds/revisions where that validation is active; max_body_size is still checked.","triggerScenarios":"Calling Validate() on an http source Configuration whose ChunkSize or MaxBodySize pointer is non-nil and points to a value <= 0, e.g. YAML `chunk_size: -1` or `max_body_size: 0`.","commonSituations":"Typo or misunderstanding in the acquisition YAML (thinking 0 means 'unlimited'); templated configs where a variable expands to empty/0; copying a sample config with a placeholder value.","solutions":["Set chunk_size/max_body_size to a positive integer (e.g. max_body_size: 10M equivalent in bytes) in the http source YAML config.","Remove the key entirely if you want the default — an unset (nil) value passes validation.","If 0/-1 came from a template variable, check the variable resolution; quote and validate values before rendering the config."],"exampleFix":"// before (acquis.yaml)\nsource: http\nmax_body_size: 0\n\n// after\nsource: http\nmax_body_size: 10485760 # 10MB, must be > 0","handlingStrategy":"validation","validationCode":"if cfg.MaxBodySize != nil && *cfg.MaxBodySize <= 0 {\n    return fmt.Errorf(\"max_body_size must be positive, got %d\", *cfg.MaxBodySize)\n}","typeGuard":"func positiveSize(p *int) bool { return p == nil || *p > 0 }","tryCatchPattern":null,"preventionTips":["Omit size keys you don't need instead of setting 0 to mean 'unlimited'.","Validate generated/templated YAML values before deployment.","Document defaults so users don't guess that 0 disables limits."],"tags":["config","validation","http"],"backgroundTag":"invalid-config-value","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}