FlowiseAI/Flowise · error · Error
Both Chat ID and User ID are required
Error message
Both Chat ID and User ID are required
What it means
Thrown by the AddChatMember Teams tool's _call when either chatId or userId is falsy after merging the runtime argument with defaultParams. The tool adds an Azure AD user as a member of a Microsoft Teams chat via the Graph API endpoint POST /chats/{chatId}/members. Both identifiers are required because the Graph API needs them to construct the user@odata.bind reference and the membership endpoint.
Source
Thrown at packages/components/nodes/tools/MicrosoftTeams/core.ts:837
description: 'Add a member to a chat',
schema: z.object({
chatId: z.string().describe('ID of the chat'),
userId: z.string().describe('ID of the user to add')
}),
baseUrl: BASE_URL,
method: 'POST',
headers: {}
}
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 {
const body = {
'@odata.type': '#microsoft.graph.aadUserConversationMember',
'user@odata.bind': `https://graph.microsoft.com/v1.0/users('${userId}')`
}
const endpoint = `/chats/${chatId}/members`
await this.makeTeamsRequest(endpoint, 'POST', body)
return this.formatResponse(
{
success: true,
message: 'Member added to chat successfully'
},
params
)View on GitHub (pinned to abe4a8601a)
Solutions
- Ensure the tool invocation payload includes both a non-empty chatId and a non-empty userId (e.g. { chatId: '19:abc...', userId: 'user-guid' }).
- If one ID is constant for the run, set it in the node's defaultParams so it merges in even when the agent omits it.
- Verify the upstream node feeding chatId/userId actually produced a value before the tool executes.
- Check that the agent's prompt or function schema describes both parameters as required.
Example fix
// before
await tool._call({ chatId: '19:meeting...' })
// after
await tool._call({ chatId: '19:meeting...', userId: 'a1b2c3d4-e5f6-...' }) Defensive patterns
Strategy: validation
Validate before calling
function hasChatAndUser(params: any): boolean {
return Boolean(params && params.chatId && params.userId)
}
// before invoking:
if (!hasChatAndUser(arg)) throw new Error('chatId and userId are required') Type guard
function isAddMemberArgs(a: unknown): a is { chatId: string; userId: string } {
return typeof a === 'object' && a !== null
&& typeof (a as any).chatId === 'string' && (a as any).chatId.length > 0
&& typeof (a as any).userId === 'string' && (a as any).userId.length > 0
} Try / catch
try {
const out = await addMemberTool.call(arg)
} catch (e) {
if (e instanceof Error && e.message === 'Both Chat ID and User ID are required') {
// surface missing-input feedback to the agent for self-correction
} else throw e
} Prevention
- Define the tool's Zod schema with chatId and userId as required strings.
- Pre-populate stable IDs via defaultParams.
- Validate upstream variables are non-empty before the tool node runs.
When it happens
Trigger: Calling the AddChatMember tool without passing chatId, without passing userId, or passing an empty string / null / undefined for either. Also triggers if defaultParams was expected to supply one but was not configured on the node.
Common situations: The LLM agent omits one of the two IDs when invoking the tool; the Flowise/agent node has chatId bound to an upstream variable that resolved to empty; the user wired the tool input schema incorrectly and left a required field blank.
Related errors
- Both Chat ID and Message ID are required
- Chat or Channel ID is required
- Chat/Channel ID and Message ID are required
- Chat/Channel ID and Message Body are required
- Chat/Channel ID, Message ID, and Reply Body are required
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/98fc945d0e2b6371.
Report an issue: GitHub.