How to download files with very long URLs?

Solution 1:

From your example it is now clear what the problem is:

Cannot write to '…' (Bad file descriptor).
converted '<very long url>' (UTF-8)
Converted file name '<many a character>' (CP1252)
The name is too long, 3814 chars total.

In this case, the solution is very easy: Just specify a target file name that is not too long:

wget -o my-result.json "<very long url>"

With GraphQL you can maybe also POST the query instead of specifying it in the URL. This would work around any URL length problems.