GDB tried to attach to the process and failed. It then tried to treat the identifier as a program in the current working directory. Arguably, it should skip that latter check if the former found a valid process but still failed to attach.

You cannot ptrace a process that is already under ptrace. According to the gdb output, process 971 is already tracing your target. Normally, I would suggest killing 971 and trying again, but since you say that is the UML process, killing it might bring down the whole UML environment.