New RPM 7 is now available — see what’s new →

Suggestions for troubleshooting filter actions

Screenshots in this article are from RPM 7.0.

At the bottom of the filter setup form are the error handling settings:

Filter error handling setup

Standard error log

The first setting, Write standard output (stderr) to file in current working directory, captures the “standard error” output if your filter uses that for error logging. It will also generate a message in the event log if this setting is on.

We are aware that some programs have their own error logging and create a file that RPM may not know about. Of course, this is not a problem. You can create all the files you like but you’ll be responsible for cleanup.

Our recommendation is that you turn on error logging for a time when you set up your filter action until you know that the setup works reliably. Only you would know how long that takes.

Note that you are responsible for removing the error logs, which is why some sites do not leave that setting enabled.

Enable the error log and study them; remember that these are errors in your program or script, not errors caused by RPM

Catch failures with the exit code

The second setting, Assume error if program returns non-zero result, is the one we’d turn on for almost every filter. Command-line programs report failure by exiting with a code other than 0. Without this setting, RPM doesn’t look at the exit code, so a program that fails still counts as a success: the job shows as complete, and nothing came out.

With it on, RPM puts the job in error when the exit code is not 0. If the program wrote a reason to standard error, the last lines of it are added to the job’s Error Text, for example:

program convert.exe returned 1: Queue lookup failed for 'pdf'

So you see why the job failed right in the job list, without opening a log file. RPM retries jobs in error, as set under Settings > General, so a failure that clears up on its own, such as a network share that was briefly unavailable, gets another try.

If you write your own filter program or script, exit with a non-zero code when it fails and write a short reason to standard error. In a batch file, that’s exit /b 1; in PowerShell, exit 1.

A few programs return a non-zero code even when they succeed. Check your program’s documentation, or run it from a command prompt and look at %ERRORLEVEL% afterward. If yours does that, leave this setting off.

More places to look

You should also review the message log for messages related to your job. I have personally witnessed command-line errors or other runtime complaints this way which may not surface otherwise. We have instructions for executing your filter command interactively.