This "Failed to process all documents" exception can be difficult to debug, because the reason isn't immediately clear.
After calling operation.result, if you drill down into the operation.metadata.individual_process_statuses, the status.message field contains the actual cause of the error.