Skip Navigation
Lemmy Support @lemmy.ml

What is the maximum username length for a Lemmy account?

Solution

The Lemmy server appears to have a database limit of 255 characters [2]; however, individual instances appear to put their own limits on username length [3][4.1][4.2].

Original Post

If you know, please also provide relevant documentation.

UPDATE (2025-02-02T06:06Z): I did some brute-force testing, and, at least for sh.itjust.works, it seems that the maximum username length is 50, and the maximum password length is 60 [1].


You're viewing a single thread.

12 comments
  • It seems to be set per-instance - you can find out through their APIs:

    curl -L http://lemmy.world/api/v3/site | jq -r .site_view.local_site.actor_name_max_length (26)

    curl -L http://sh.itjust.works/api/v3/site | jq -r .site_view.local_site.actor_name_max_length (50)

    • Is there any official documentation for that? Lemmy's API docs [1] seem rather sparse on the subject.

      UPDATE (2025-02-02T23:23Z): I found this [2] and this [3], but unfortunately it doesn't contain much information.

      • Not much. I think Lemmy's current API docs are generated from the JS client. So I guess there's

        https://join-lemmy.org/lemmy-js-client-docs/v0.19/interfaces/LocalSite.html#actor_name_max_length

        This refers to the wrong line number though, it's actually at:

        https://github.com/LemmyNet/lemmy-js-client/blob/ad9f402e06292899a35927c46fe48b22c6f5eb27/src/types/LocalSite.ts#L59

        • Is it known for sure that name is the username? Could it be the display name? In the ActivityPub spec, I found this [1]:

          name

          The preferred "nickname" or "display name" of the actor.

          • I'm not used to this level of rigour to be honest. You've accepted your own unscientific prodding of one particular instance as an answer, and one link to a years-old migration as a answer, but I give you reproducible command-line instructions, which match up with your own findings, and it's apparently not good enough.

            Anyway, as that migration shows, Lemmy distinguishes between 'name' for username, and 'display_name' for the display name. A better link for this is arguably https://github.com/LemmyNet/lemmy/blob/main/crates/db_schema/src/schema.rs#L735 but whatever. It's these fields that are relevant to Lemmy's API, not the terminology that ActivityPub uses. A client might reasonably want to know the limit for a username (as provided in the Site response), because it's this that's used for Signup and Login. Display name is set elsewhere, once that's done, so it doesn't make sense for actor_name_max_length to refer to this.

            Within ActivityPub, the distinction between username and display name is 'preferredUsername' and 'name', but AP also uses 'name' for a bunch of other things (including but not limited to what becomes a post title, a choice in a poll, or the alt-text for an image). There's some overlap with how Lemmy's API refers to stuff (e.g. a post title is a post name), but it not a 1:1 match.

            I hope this is enough. I don't even use Lemmy, so - in my opinion - you're asking the wrong question to the wrong person. What you should be asking, is - "How come when I post a question to Lemmy's support community, on the instance owned by Lemmy devs, it looks like they just ignore it?". You shouldn't have to be relying on guesswork by amateurs, irrespective of how many 'references' they can quote.

12 comments