OrchardCMS/OrchardCore · error · AntivirusScanningException
The ClamAV antivirus scanner is enabled but the transfer…
Error message
The ClamAV antivirus scanner is enabled but the transfer timeout must be greater than zero.
What it means
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.
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.
Example fix
// before options.TransferTimeoutSeconds = 0; // after options.TransferTimeoutSeconds = 300;
Defensive patterns
Strategy: validation
Validate before calling
if (options.TransferTimeoutSeconds <= 0)
throw new InvalidOperationException("ClamAV TransferTimeoutSeconds must be greater than zero."); Try / catch
try
{
await UploadFileAsync(stream);
}
catch (AntivirusScanningException ex) when (ex.Message.Contains("transfer timeout"))
{
// fix configuration before accepting uploads
} Prevention
- 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.
When it happens
Trigger: Antivirus feature enabled, upload triggers CreatingAsync, and ClamAvOptions.TransferTimeoutSeconds is 0 or negative in configuration.
Common situations: Only Host/Port/ConnectTimeout configured while transfer timeout stays 0, config binding failure, or setting 0 intending 'unlimited'.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- The ClamAV antivirus scanner is enabled but the connection…
- The ClamAV antivirus scanner is enabled but the port…
- The file extension should start with a dot.
- The variable ' ' was used in the recipe but not defined…
- The ClamAV antivirus scanner timed out while scanning
AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13).
Data as JSON: /api/errors/447c930a28be62a7.
Report an issue: GitHub.
Appendix: source
Thrown at src/OrchardCore.Modules/OrchardCore.Antivirus/ClamAV/ClamAvFileEventHandler.cs:179
{
if (string.IsNullOrWhiteSpace(_options.Host))
{
throw new AntivirusScanningException("The ClamAV antivirus scanner is enabled but the host setting is missing.");
}
if (_options.Port is < 1 or > 65535)
{
throw new AntivirusScanningException("The ClamAV antivirus scanner is enabled but the port setting is invalid.");
}
if (_options.ConnectTimeoutSeconds <= 0)
{
throw new AntivirusScanningException("The ClamAV antivirus scanner is enabled but the connection timeout must be greater than zero.");
}
if (_options.TransferTimeoutSeconds <= 0)
{
throw new AntivirusScanningException("The ClamAV antivirus scanner is enabled but the transfer timeout must be greater than zero.");
}
}
}
View on GitHub (pinned to 4306c0717f)