Were you trying to or install custom software when this happened? Do you have access to a computer to help fix it?
Since the on-device recovery is failing, you must use an external agent. Were you trying to or install custom software