Actually in your case it might be that an exception is thrown and captured by the agent in some part of your application (for example in a high-level framework like Spring MVC that might use an exception to indicate a missing resource), but this exception is caught elsewhere in the application in a low-level framwework like Servlets when it's mapped to the 404 HTTP status code.
When such thing happen, it means that the transaction might be captured as success, whereas there was an exception captured when the transaction was active (shown as an error in UI).
In order to deal with such cases, you could rely on the related error documents that have an transaction.id attribute instead of relying on the transactions that have an event.outcome = failure.