medusajs/medusa · error · MedusaError
User ID not found
Error message
User ID not found
What it means
Thrown by GET /admin/users/me when the auth context carries no actor_id. Indicates the request is authenticated but not linked to a user actor.
Source
Thrown at packages/medusa/src/api/admin/users/me/route.ts:20
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/framework/http"
import { HttpTypes } from "@medusajs/framework/types"
import {
ContainerRegistrationKeys,
MedusaError,
remoteQueryObjectFromString,
} from "@medusajs/framework/utils"
export const GET = async (
req: AuthenticatedMedusaRequest<HttpTypes.AdminUserParams>,
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
- Ensure the auth identity is associated with a user (complete registration/login flow)
- Re-issue the token after the user is created and linked
- Check custom auth provider callbacks set actor_id correctly
Defensive patterns
Strategy: try-catch
Type guard
const hasActorId = (ctx: {actor_id?: string|null}): ctx is {actor_id: string} => typeof ctx.actor_id === 'string' && ctx.actor_id.length > 0 Try / catch
catch (e) { if (e.type === 'not_found') forceReauth() } Prevention
- Decode the JWT and assert actor_id before calling /me
- Re-login after registration flows
When it happens
Trigger: Calling /admin/users/me with a token whose auth_context has no actor_id (e.g. a third-party service token or incomplete auth registration).
Common situations: Using a JWT minted before the user was fully registered; authenticating with a provider that created an auth identity but no user; custom auth flows that skip actor linking.
Related errors
- User with id: ${id} was 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/01ea858320271b8b.
Report an issue: GitHub.