I am writing a Java wrapper around a system call to the clamscan executable.

I've been trying to find a list of Error and Warning messages given by clamscan without success.

For example, I've seen clamscan issues warnings such as...

"Warning: *** The virus database is older than 7 days!"

...and errors such as...

"LibClamAV Error: cli_load(): Can't open file /var/lib/clamav/bytecode.cvd"

Is there a way to obtain a list of all possible warnings and errors?

1 Answer 1


There isn't a hardcoded list of warnings or error messages anywhere - these messages are basically just print statements. The list of messages that might be displayed (and the contents of them) may vary between releases and based on how ClamAV is configured.

If you really wanted to build a list, a starting place would be to search the code for cli_warnmsg or cli_errmsg. For example: https://github.com/Cisco-Talos/clamav-devel/search?q=cli_errmsg&unscoped_q=cli_errmsg

Instead of tightly coupling your code to the contents of these messages, another approach you could take is to just inspect stderr after running clamscan and maybe take some action based on that. freshclam does something similar (See: https://github.com/Cisco-Talos/clamav-devel/blob/5087673200af439707dab8ae44c7b567cdabc567/freshclam/manager.c#L1426).

The most reliable way to determine whether an error occurred would be to just check the return value of clamscan, although from reading the man page there are only 3 possible return codes (0: no virus found; 1: virus found; 2: an error occurred). Maybe combining this with the approach above would be enough to allow your wrapper to indicate if the scan succeeded or not, and provide the warnings/errors so that the user could hopefully determine what went wrong.

  • The scan has finished, and some files can't be accessed by clamscan and it returns error code 2. Probably need to let us determine whether some return codes 2 can be treated as a success. The 3 return codes are not enough, we need more.
    – MaXi32
    Nov 28, 2022 at 3:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .