{"record":{"id":"447c930a28be62a7","repo":"OrchardCMS/OrchardCore","slug":"the-clamav-antivirus-scanner-is-enabled-but-the-transfer","errorCode":null,"errorMessage":"The ClamAV antivirus scanner is enabled but the transfer timeout must be greater than zero.","messagePattern":"The ClamAV antivirus scanner is enabled but the transfer timeout must be greater than zero\\.","errorType":"exception","errorClass":"AntivirusScanningException","httpStatus":null,"severity":"error","filePath":"src/OrchardCore.Modules/OrchardCore.Antivirus/ClamAV/ClamAvFileEventHandler.cs","lineNumber":179,"sourceCode":"    {\n        if (string.IsNullOrWhiteSpace(_options.Host))\n        {\n            throw new AntivirusScanningException(\"The ClamAV antivirus scanner is enabled but the host setting is missing.\");\n        }\n\n        if (_options.Port is < 1 or > 65535)\n        {\n            throw new AntivirusScanningException(\"The ClamAV antivirus scanner is enabled but the port setting is invalid.\");\n        }\n\n        if (_options.ConnectTimeoutSeconds <= 0)\n        {\n            throw new AntivirusScanningException(\"The ClamAV antivirus scanner is enabled but the connection timeout must be greater than zero.\");\n        }\n\n        if (_options.TransferTimeoutSeconds <= 0)\n        {\n            throw new AntivirusScanningException(\"The ClamAV antivirus scanner is enabled but the transfer timeout must be greater than zero.\");\n        }\n    }\n}\n","sourceCodeStart":161,"sourceCodeEnd":183,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore.Modules/OrchardCore.Antivirus/ClamAV/ClamAvFileEventHandler.cs#L161-L183","documentation":"ValidateOptions requires TransferTimeoutSeconds > 0 when ClamAV is enabled. A zero or negative transfer timeout throws this AntivirusScanningException during the first file scan, since stream transfer to clamd must have a positive deadline.","triggerScenarios":"Antivirus feature enabled, upload triggers CreatingAsync, and ClamAvOptions.TransferTimeoutSeconds is 0 or negative in configuration.","commonSituations":"Only Host/Port/ConnectTimeout configured while transfer timeout stays 0, config binding failure, or setting 0 intending 'unlimited'.","solutions":["Set TransferTimeoutSeconds to a positive value sized for your largest upload (e.g. 300).","Review the full ClamAV options block for unset numeric settings defaulting to 0.","Validate options at startup to fail fast.","If scans are timing out afterward, raise the value rather than disabling it."],"exampleFix":"// before\noptions.TransferTimeoutSeconds = 0;\n// after\noptions.TransferTimeoutSeconds = 300;","handlingStrategy":"validation","validationCode":"if (options.TransferTimeoutSeconds <= 0)\n    throw new InvalidOperationException(\"ClamAV TransferTimeoutSeconds must be greater than zero.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    await UploadFileAsync(stream);\n}\ncatch (AntivirusScanningException ex) when (ex.Message.Contains(\"transfer timeout\"))\n{\n    // fix configuration before accepting uploads\n}","preventionTips":["Compute TransferTimeoutSeconds from max upload size and expected scan throughput.","Set every ClamAV option explicitly per environment.","Add startup options validation to catch unset values."],"tags":["clamav","configuration","timeout","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}