FlowiseAI/Flowise · error · Error
Both Chat ID and Message ID are required
Error message
Both Chat ID and Message ID are required
What it means
Thrown by the PinChatMessage Teams tool's _call when chatId or messageId is falsy after merging the argument with defaultParams. The tool pins an existing message in a chat via POST /chats/{chatId}/pinnedMessages with an odata.bind reference to the message. Both IDs are needed to build the reference URL and the endpoint.
Source
Thrown at packages/components/nodes/tools/MicrosoftTeams/core.ts:935
description: 'Pin a message in a chat',
schema: z.object({
chatId: z.string().describe('ID of the chat'),
messageId: z.string().describe('ID of the message to pin')
}),
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, messageId } = params
if (!chatId || !messageId) {
throw new Error('Both Chat ID and Message ID are required')
}
try {
const body = {
message: {
'@odata.bind': `https://graph.microsoft.com/v1.0/chats('${chatId}')/messages('${messageId}')`
}
}
const endpoint = `/chats/${chatId}/pinnedMessages`
await this.makeTeamsRequest(endpoint, 'POST', body)
return this.formatResponse(
{
success: true,
message: 'Message pinned successfully'
},
paramsView on GitHub (pinned to abe4a8601a)
Solutions
- Supply both chatId and messageId as non-empty strings in the tool payload.
- Capture the messageId from the prior send/list message tool call and thread it into the pin call.
- Set stable IDs in defaultParams when one is constant for the conversation.
- Mark both fields required in the tool schema exposed to the agent.
Example fix
// before
await pinTool._call({ chatId: '19:...' })
// after
const sent = await sendTool._call({ chatChannelId: '19:...', messageBody: 'hi' })
const messageId = JSON.parse(sent).id
await pinTool._call({ chatId: '19:...', messageId }) Defensive patterns
Strategy: validation
Validate before calling
function hasChatAndMessage(params: any): boolean {
return Boolean(params && params.chatId && params.messageId)
} Type guard
function isPinArgs(a: unknown): a is { chatId: string; messageId: string } {
return typeof a === 'object' && a !== null
&& typeof (a as any).chatId === 'string' && (a as any).chatId.length > 0
&& typeof (a as any).messageId === 'string' && (a as any).messageId.length > 0
} Try / catch
try {
await pinTool.call(arg)
} catch (e) {
if (e instanceof Error && e.message === 'Both Chat ID and Message ID are required') {
// request both IDs
} else throw e
} Prevention
- Thread messageId from the prior send/list step.
- Expose chatId and messageId as required in the agent schema.
When it happens
Trigger: Calling PinChatMessage without chatId or messageId; either value empty/null; defaultParams not configured to fill the gap.
Common situations: Agent attempts to pin a message but only knows the chat, not the message id; the messageId was supposed to come from a prior 'send message' step that failed; node wiring leaves a required input unbound.
Related errors
- Both Chat ID and User 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/b36e34fd2281a081.
Report an issue: GitHub.