{"record":{"id":"ae5066e7ade60a92","repo":"dutchcoders/transfer.sh","slug":"clamav-host-not-set","errorCode":null,"errorMessage":"clamav-host not set","messagePattern":"clamav-host not set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cmd.go","lineNumber":414,"sourceCode":"\t\t} else {\n\t\t\toptions = append(options, server.Logger(logger))\n\t\t}\n\n\t\tif v := c.String(\"lets-encrypt-hosts\"); v != \"\" {\n\t\t\toptions = append(options, server.UseLetsEncrypt(strings.Split(v, \",\")))\n\t\t}\n\n\t\tif v := c.String(\"virustotal-key\"); v != \"\" {\n\t\t\toptions = append(options, server.VirustotalKey(v))\n\t\t}\n\n\t\tif v := c.String(\"clamav-host\"); v != \"\" {\n\t\t\toptions = append(options, server.ClamavHost(v))\n\t\t}\n\n\t\tif v := c.Bool(\"perform-clamav-prescan\"); v {\n\t\t\tif c.String(\"clamav-host\") == \"\" {\n\t\t\t\treturn errors.New(\"clamav-host not set\")\n\t\t\t}\n\n\t\t\toptions = append(options, server.PerformClamavPrescan(v))\n\t\t}\n\n\t\tif v := c.Int64(\"max-upload-size\"); v > 0 {\n\t\t\toptions = append(options, server.MaxUploadSize(v))\n\t\t}\n\n\t\tif v := c.Int(\"rate-limit\"); v > 0 {\n\t\t\toptions = append(options, server.RateLimit(v))\n\t\t}\n\n\t\tv := c.Int(\"random-token-length\")\n\t\toptions = append(options, server.RandomTokenLength(v))\n\n\t\tpurgeDays := c.Int(\"purge-days\")\n\t\tpurgeInterval := c.Int(\"purge-interval\")","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/dutchcoders/transfer.sh/blob/c37bfd95797fd6da8a6da53fc13d191994b3f687/cmd/cmd.go#L396-L432","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)"],"exampleFix":"// before\ntransfer.sh --perform-clamav-prescan\n// after\ntransfer.sh --perform-clamav-prescan --clamav-host clamav.internal:3310","handlingStrategy":"validation","validationCode":"// shell pre-flight before launching the server\nif [ \"$ENABLE_CLAMAV\" = \"true\" ] && [ -z \"$CLAMAV_HOST\" ]; then\n  echo \"--perform-clamav-prescan requires --clamav-host\" >&2; exit 1\nfi","typeGuard":null,"tryCatchPattern":"// Go: treat RunE's returned error as fatal config feedback\nif err := cmd.Root.Execute(); err != nil {\n  if strings.Contains(err.Error(), \"clamav-host not set\") {\n    log.Fatalf(\"config error: enable clamav prescan only with --clamav-host\")\n  }\n  os.Exit(1)\n}","preventionTips":["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"],"tags":["cli","configuration","clamav","startup-validation"],"backgroundTag":"missing-required-flag","analyzedSha":"c37bfd95797fd6da8a6da53fc13d191994b3f687","analyzedAt":"2026-09-05T10:21:07.548Z","contentChangedAt":"2026-09-05T10:21:07.548Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}