Is the cost of a failed job refunded?

Yes - if a job fails with an error, the cost of the job is refunded.

Check the Solve Details dialog and fix the problem before sending the job to be solved again.