I came across similar error on .net v 4.6.1.
When I upgrade GroupDocs.Merger to Version 22.1 and use stream as input I’m getting this error:
GroupDocsMergerException: Failed to detect file type.
This issue is already under investigation. Your investigation ticket ID is MERGERNET-1204. We’ll notify you in case of any update.