What FIRSTNAME_INVALID means
The error comes up when you change a profile and the account sends a new name. In the error table for the account.updateProfile method it is described as an invalid first name, with code 400. Libraries show it in different ways: in Telethon it is FirstNameInvalidError, and in logs it is often written as "first name invalid".
Why it appears
Telegram's documentation does not list which names get rejected, so the exact rule cannot be stated. Check the string itself first: the name may have arrived empty, made of spaces only, or with special characters that Telegram does not accept.
- The name was built from a template and a variable stayed empty.
- Service or invisible characters got into the string from a spreadsheet or someone else's file.
- The name consists only of spaces and punctuation.
What to do
- Check that the name is not empty and reads like an ordinary name, with no extra marks.
- Remove invisible characters. The easiest way is to type the name again instead of copying it.
- Try saving the same name in the Telegram app. If it does not save there either, Telegram rejects the name itself, not the way it was sent.
- Do not repeat the request in a series. Telegram may answer
FLOOD_WAIT.