medusajs/medusa · error · MedusaError
User with id: ${id} was not found
Error message
User with id: ${id} was not found What it means
Thrown by GET /admin/users/me when a user id exists in the auth context but no matching user row is found via remote query.
Source
Thrown at packages/medusa/src/api/admin/users/me/route.ts:32
res: MedusaResponse<HttpTypes.AdminUserResponse>
) => {
const id = req.auth_context.actor_id
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
if (!id) {
throw new MedusaError(MedusaError.Types.NOT_FOUND, `User ID not found`)
}
const query = remoteQueryObjectFromString({
entryPoint: "user",
variables: { id },
fields: req.queryConfig.fields,
})
const [user] = await remoteQuery(query)
if (!user) {
throw new MedusaError(
MedusaError.Types.NOT_FOUND,
`User with id: ${id} was not found`
)
}
res.status(200).json({ user })
}
View on GitHub (pinned to 5e06e544a2)
Solutions
- Verify the user exists in the user module and recreate if needed
- Invalidate outstanding JWTs after deleting users
- Re-authenticate to obtain a token tied to an existing user
Defensive patterns
Strategy: try-catch
Try / catch
catch (e) { if (e.type === 'not_found') logoutAndReauth() } Prevention
- Invalidate tokens when deleting users
- Monitor auth/user data drift
When it happens
Trigger: Valid JWT with an actor_id pointing to a deleted or nonexistent user; data drift between auth identities and the user module.
Common situations: User deleted directly in the database while tokens remain valid; user module data out of sync with auth module after imports or migrations.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- User ID not found
- User with id "${userId}" not found
- User with id: ${id} was not found
- Provider identity with entity_id ${data.entity_id} and provi
- AuthIdentity with entity_id "${entity_id}" not found
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/89f23d4abba6a4ab.
Report an issue: GitHub.