ErrLookup › Background articles › "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm
"User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm
"User not found" and its siblings ("Invalid user", error-invalid-user, NoSuchUser, "No such user exists") fire when code resolves a username, userId, or access key against a user store and the lookup comes back empty. Developers hit this family across Rocket.Chat methods and REST endpoints, LiteLLM's proxy user routes, Phabricator CLI workflows, rustfs IAM operations, and pnpm registry commands — usually because of a typo'd or renamed identifier, a deleted account, a stale session token, or a value (display name, email, or ID) sent where a different identifier type was expected.
Distilled from 78 documented records across 10 repositories.
Background
This family sits at the identity-resolution layer: after authentication succeeds and before the real operation runs, nearly every library performs a lookup — Users.findOneByUsername, findOneById, prisma get_data, PhabricatorPeopleQuery, an IAM store read — and throws when the result is null. The error is therefore a precondition failure, not a crash: no side effects have occurred (Rocket.Chat's deleteUser, for example, checks the target before any protection logic or deletion). From the caller's side it surfaces as a 400/404 HTTP response, a Meteor.Error like error-invalid-user, a CLI PhutilArgumentUsageException, or a 404-class IAM error, almost always naming the identifier that failed to resolve.
The semantics vary by which identifier was looked up. Username-based lookups (Rocket.Chat's REST params, integration post-as users, roles.removeUserFromRole; Phabricator's --from; pnpm stars) are typically exact and often case-sensitive, so display names, emails, wrong casing, or trailing whitespace all miss. ID-based lookups (Rocket.Chat's findOneById paths, LiteLLM's user_id fetches) fail on typos, truncation, URL-encoding differences ('+' decoded to a space in LiteLLM), or accounts deleted after the ID was captured. A distinct sub-group is the stale-session case: the acting user's own record vanished while their token stayed valid, which several Rocket.Chat methods (getMentionedMessages, setReaction, banUser) flag as an integrity signal meaning "re-authenticate," not "retry."
Libraries disagree on how much the error tells you. LiteLLM's /v2/user/info deliberately returns the same 404 whether the user is missing or merely forbidden, to avoid leaking which IDs exist; rustfs's NoSuchUser embeds the access key in the message; Rocket.Chat mostly interpolates nothing and relies on separate error codes (error-invalid-user vs error-invalid-desired-user vs error-user-param-not-provided) to distinguish value-supplied-but-unmatched from param-omitted. Some throws are misleading: Rocket.Chat's unarchiveRoom error details name 'archiveRoom' (a copy-paste artifact), and 'User is not in this room' from removeUserFromRoom actually means the user does not exist in the workspace at all, not that membership is missing.
Behavior on failure also varies: Rocket.Chat's addUsersToRoom runs inside Promise.all, so one unknown username rejects the entire invitation batch, while its delete/update flows treat the miss as a clean no-op state. pnpm adds a registry wrinkle — a 404 on user stars can mean the registry never implemented the /-/user/<name>/stars endpoints, making every username "not found" regardless of existence.
Common causes
- Typo'd, mis-cased, or malformed identifier. Exact-match lookups miss on wrong casing ('Rocket.Cat' vs 'rocket.cat'), trailing whitespace, truncated IDs, or broken URL encoding (LiteLLM notes '+' decoded to a space). Empty strings also resolve nothing.
- Wrong identifier type supplied. Passing a display name ('CI Bot'), email address, or real name where a username is expected, or a username where an _id/access key is expected. Rocket.Chat's userId param is matched by _id only, so 'rocket.cat' inside it fails.
- Deleted, renamed, or merged account. The identifier was valid when captured but the user has since been deleted, renamed (integrations still posting as the old username), or merged. Renames without updating references are a recurring trigger in Rocket.Chat integration records.
- Stale session or token referencing a removed user. The acting user's record was deleted while their token stayed valid, so every method resolving this.userId throws 'Invalid user'. This is an integrity signal: re-authenticate rather than retry.
- Race between capture and use. The user existed when listed but was deleted before the call — double-submitted deletes, stale admin-table IDs, concurrent deletion, or (in multi-node deployments) replication lag hiding the user from the node processing the command.
- Incomplete provisioning or missing username field. User documents without a username (bot/app accounts, mid-provisioning users) fail role and system-message paths in Rocket.Chat because those flows key off username. Fire-and-forget user creation that wasn't awaited produces the same miss.
- Permission masking or environment mismatch. LiteLLM's /v2/user/info returns 404 for forbidden targets, not just missing ones; Phabricator's policy filters can hide an existing user from the viewer; IDs copied between workspaces or deployments never resolve locally.
- Endpoint or feature not supported. pnpm's USER_NOT_FOUND on stars frequently means the registry never implemented the /-/user/<name>/stars endpoints — a persistent failure for every user indicates an endpoint-support problem, not a user problem.
What usually fixes it
- Resolve the identifier first with a read endpoint (users.info, /user/list, an IAM admin listing, a People query) and send the exact, current value — canonical username or _id, freshly fetched rather than cached.
- Send the right identifier type: usernames (not display names, emails, or real names) in username params, and Mongo _ids / access keys in userId-type params. Trim whitespace and URL-encode values containing '+' or '@'.
- Classify before retrying: a deleted target is terminal (treat delete/update misses as idempotent success or a no-op), while 'Invalid user' on the acting session means log out and re-authenticate — retries never help.
- Handle lifecycle events: invalidate tokens and sessions when users are deleted or renamed, sweep integrations and group/policy memberships that reference them, and reconcile IAM stores after restoring from backup.
- Guard bulk operations: pre-resolve every username in batch flows (Rocket.Chat's addUsersToRoom rejects the whole batch on one miss), dropping or reporting unknown entries so one bad value cannot abort the set.
- In multi-node deployments, read user lookups from the primary before processing user-triggered commands so replication lag cannot turn a live user into a not-found.
Go deeper
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
- HTTP status errors: handling 4xx and 5xx responses — how to handle 4xx and 5xx responses properly.
Documented occurrences
- error-user-not-in-room: User is not in this room (RocketChat/Rocket.Chat)
- error-invalid-post-as-user: Invalid Post As User (RocketChat/Rocket.Chat)
- invalid-user (RocketChat/Rocket.Chat)
- error-user-not-found: Inviter not found (RocketChat/Rocket.Chat)
- error-invalid-user: The required "userId" or "username" param provided does not match any users (RocketChat/Rocket.Chat)
- error-user-not-found: User not found (RocketChat/Rocket.Chat)
- We could not find an account to resubscribe. (freeCodeCamp/freeCodeCamp)
- user '{0}' does not exist (rustfs/rustfs)
- error-contact-manager-not-found: No user found with username ${contactManager.username} (RocketChat/Rocket.Chat)
- error-invalid-user: Invalid user to unmute (RocketChat/Rocket.Chat)
- User not found. Only PROXY_ADMIN can create users via /user/update; use /user/new instead. (BerriAI/litellm)
- error-invalid-user: There is no user with this username (RocketChat/Rocket.Chat)
- No such user '%s' exists. (phacility/phabricator)
- error-invalid-user: Invalid user (RocketChat/Rocket.Chat)
- error-invalid-user: Invalid user (RocketChat/Rocket.Chat)
- f"User not found: {user_id}" (BerriAI/litellm)
- error-invalid-user: Invalid user (RocketChat/Rocket.Chat)
- error-invalid-user: Invalid user to delete (RocketChat/Rocket.Chat)
- USER_NOT_FOUND: User "${username}" not found (pnpm/pnpm)
- error-invalid-user: Invalid user (did you delete the `rocket.cat` user?) (RocketChat/Rocket.Chat)
…and 58 more across the corpus — use search.
Honest provenance: generated on 2026-08-27 from AI-assisted analysis of the linked records. See how records are made.