The baud is right, otherwise plain AT wouldn’t answer OK either. ERROR:(0) is the HC-05’s code for a command it couldn’t parse, and with this module that almost always means the line ending. It wants every command to end with CR+LF. If the Serial Monitor is on «No line ending» or «Newline» only, the short «AT» sometimes gets through and the longer commands don’t.
Set the monitor to «Both NL & CR». Also type the commands in capitals, and on some firmware versions AT+NAME only works while the KEY/EN pin is held high the whole time, not only at power-up. If NAME still fails, tie KEY to 3.3 V with a wire while you send it.
AT+UART=9600,0,0 then sets the data mode baud. AT mode stays at 38400 regardless.

