Hi Tobias,
This error often occurs when some hanging process wasn’t closed during SSH sessions logout (for instance tail commands…). It seems to be related to how systemd-run allocates terminals.
A reboot could resolve it. If not possible the following command can help to list, search (and kill) hanging sessions manually
loginctl
We had similar issues in the past:
Search results for '"Failed to get machine PTY"' - NethServer Community
Here is @giacomo’s reply to a similar one: