It seems that you're trying to execute Racket's built-in sort
procedure, which in fact receives 2 arguments (a list and a comparison procedure) plus optional arguments with keywords.
Make sure that the sort
procedure you defined is in fact the one that gets called, by defining it first before the point where you're actually using it, or just to be sure rename it to say, mysort
and use that name consistently - because anyway it's not always a good idea to overwrite existing procedures.