dutchcoders/transfer.sh · error
clamav-host not set
Error message
clamav-host not set
What it means
This error is thrown by the transfer.sh CLI at startup when the --perform-clamav-prescan flag is enabled but no --clamav-host was provided. The ClamAV prescan feature requires a reachable ClamAV (clamd) instance, and the host flag is the only way to locate it, so the command refuses to configure the server with a prescan option pointing nowhere. It is a fail-fast validation in the serve/start command rather than a runtime failure.
Source
Thrown at cmd/cmd.go:414
} else {
options = append(options, server.Logger(logger))
}
if v := c.String("lets-encrypt-hosts"); v != "" {
options = append(options, server.UseLetsEncrypt(strings.Split(v, ",")))
}
if v := c.String("virustotal-key"); v != "" {
options = append(options, server.VirustotalKey(v))
}
if v := c.String("clamav-host"); v != "" {
options = append(options, server.ClamavHost(v))
}
if v := c.Bool("perform-clamav-prescan"); v {
if c.String("clamav-host") == "" {
return errors.New("clamav-host not set")
}
options = append(options, server.PerformClamavPrescan(v))
}
if v := c.Int64("max-upload-size"); v > 0 {
options = append(options, server.MaxUploadSize(v))
}
if v := c.Int("rate-limit"); v > 0 {
options = append(options, server.RateLimit(v))
}
v := c.Int("random-token-length")
options = append(options, server.RandomTokenLength(v))
purgeDays := c.Int("purge-days")
purgeInterval := c.Int("purge-interval")View on GitHub (pinned to c37bfd9579)
Solutions
- Pass --clamav-host pointing at your clamd instance, e.g. --clamav-host clamav.example.com:3310
- If prescanning is not actually required, remove/disable the --perform-clamav-prescan flag
- Set both flags together in your deployment config so one cannot be enabled without the other
- Verify the flag is actually reaching the process (print args, check the Docker/systemd command line for quoting issues that empty the value)
Example fix
// before transfer.sh --perform-clamav-prescan // after transfer.sh --perform-clamav-prescan --clamav-host clamav.internal:3310
Defensive patterns
Strategy: validation
Validate before calling
// shell pre-flight before launching the server if [ "$ENABLE_CLAMAV" = "true" ] && [ -z "$CLAMAV_HOST" ]; then echo "--perform-clamav-prescan requires --clamav-host" >&2; exit 1 fi
Try / catch
// Go: treat RunE's returned error as fatal config feedback
if err := cmd.Root.Execute(); err != nil {
if strings.Contains(err.Error(), "clamav-host not set") {
log.Fatalf("config error: enable clamav prescan only with --clamav-host")
}
os.Exit(1)
} Prevention
- Keep --clamav-host and --perform-clamav-prescan in the same config block/template so they ship together
- Fail fast in CI/deploy scripts by validating the flag pair before start
- Document the dependency in your service README and systemd unit comments
When it happens
Trigger: Running the server with --perform-clamav-prescan (or the equivalent bool flag set to true) while --clamav-host is empty — e.g. omitting the flag, relying on an env var that the CLI does not read, or a flag alias typo like --clamav-host= without a value.
Common situations: Deploying transfer.sh behind Docker or systemd where only the prescan toggle was copied from a template but the ClamAV host line was dropped; enabling AV scanning in staging where clamd runs on a different host whose address was never wired into the flags; upgrading a config file that predates the clamav options.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- access-key not set.
- secret-key not set.
- bucket not set.
- gdrive-client-json-filepath not set.
- gdrive-local-config-path not set.
AI-assisted analysis of dutchcoders/transfer.sh@c37bfd9579 (2026-09-05).
Data as JSON: /api/errors/ae5066e7ade60a92.
Report an issue: GitHub.