FlowiseAI/Flowise · warning · Error
User is not a member of this chat
Error message
User is not a member of this chat
What it means
Thrown by RemoveChatMember after it successfully lists the chat's members at GET /chats/{chatId}/members but finds no member whose userId matches the supplied userId. This is a conditional runtime error indicating the user is not currently a participant in the chat, so there is no membership to delete.
Source
Thrown at packages/components/nodes/tools/MicrosoftTeams/core.ts:894
super({ ...toolInput, accessToken: args.accessToken, defaultParams: args.defaultParams })
}
protected async _call(arg: any): Promise<string> {
const params = { ...arg, ...this.defaultParams }
const { chatId, userId } = params
if (!chatId || !userId) {
throw new Error('Both Chat ID and User ID are required')
}
try {
// First get the membership ID
const membersEndpoint = `/chats/${chatId}/members`
const membersResult = await this.makeTeamsRequest(membersEndpoint)
const member = membersResult.value?.find((m: any) => m.userId === userId)
if (!member) {
throw new Error('User is not a member of this chat')
}
const endpoint = `/chats/${chatId}/members/${member.id}`
await this.makeTeamsRequest(endpoint, 'DELETE')
return this.formatResponse(
{
success: true,
message: 'Member removed from chat successfully'
},
params
)
} catch (error) {
return this.formatResponse(`Error removing chat member: ${error}`, params)
}
}
}
View on GitHub (pinned to abe4a8601a)
Solutions
- First call a list-members tool to confirm the user is present before attempting removal.
- Treat this error as benign if the goal is just to ensure the user is gone (idempotent removal).
- Verify the userId matches the tenant of the chat (same Azure AD object ID format).
- Refresh any cached member list before retrying.
Example fix
// before: blind removal
await removeMemberTool._call({ chatId, userId })
// after: check membership first
const members = await listMembersTool._call({ chatId })
const isMember = JSON.parse(members).some(m => m.userId === userId)
if (isMember) await removeMemberTool._call({ chatId, userId }) Defensive patterns
Strategy: validation
Validate before calling
async function isChatMember(listTool: any, chatId: string, userId: string): Promise<boolean> {
const res = await listTool.call({ chatId })
const data = JSON.parse(res)
return Array.isArray(data.value) && data.value.some((m: any) => m.userId === userId)
} Type guard
null
Try / catch
try {
await removeMemberTool.call({ chatId, userId })
} catch (e) {
if (e instanceof Error && e.message === 'User is not a member of this chat') {
// already removed: treat as success (idempotent)
} else throw e
} Prevention
- Treat removal as idempotent: a 'not a member' result is success.
- Refresh the member list before retrying.
- Confirm the userId belongs to the same tenant as the chat.
When it happens
Trigger: Calling RemoveChatMember for a user who already left or was never added; using a userId that belongs to a different tenant; the chat membership list is stale because the user was removed by another process; case/format mismatch between the supplied userId and the userId field returned by Graph.
Common situations: Idempotency issue: an agent retries a removal that already succeeded; cross-tenant confusion where a userId from tenant A is used against a chat in tenant B; the agent picked a stale userId from a cached member list.
Related errors
- Message is not pinned in this chat
- Both Chat ID and User ID are required
- Both Chat ID and Message ID are required
- Chat or Channel ID is required
- Chat/Channel ID and Message ID are required
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/65f4ab220e4c0be2.
Report an issue: GitHub.