FlowiseAI/Flowise · error · Error

Chat or Channel ID is required

Error message

Chat or Channel ID is required

What it means

Thrown by the ListMessages Teams tool's _call when chatChannelId is falsy after merging the argument with defaultParams. The tool lists messages from either a channel (GET /teams/{teamId}/channels/{chatChannelId}/messages) when teamId is present, or a chat (GET /chats/{chatChannelId}/messages). chatChannelId is required; teamId is optional and only switches the endpoint shape.

Source

Thrown at packages/components/nodes/tools/MicrosoftTeams/core.ts:1037

            schema: z.object({
                chatChannelId: z.string().describe('ID of the chat or channel to list messages from'),
                teamId: z.string().optional().describe('ID of the team (required for channel messages)'),
                maxResults: z.number().optional().default(50).describe('Maximum number of messages to return')
            }),
            baseUrl: BASE_URL,
            method: 'GET',
            headers: {}
        }

        super({ ...toolInput, accessToken: args.accessToken, defaultParams: args.defaultParams })
    }

    protected async _call(arg: any): Promise<string> {
        const params = { ...arg, ...this.defaultParams }
        const { chatChannelId, teamId, maxResults = 50 } = params

        if (!chatChannelId) {
            throw new Error('Chat or Channel ID is required')
        }

        try {
            let endpoint: string
            if (teamId) {
                // Channel messages
                endpoint = `/teams/${teamId}/channels/${chatChannelId}/messages?$top=${maxResults}`
            } else {
                // Chat messages
                endpoint = `/chats/${chatChannelId}/messages?$top=${maxResults}`
            }

            const result = await this.makeTeamsRequest(endpoint)

            return this.formatResponse(
                {
                    success: true,
                    messages: result.value || [],

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Supply a non-empty chatChannelId in the tool payload.
  2. If listing channel messages, also supply teamId; for chat messages it can be omitted.
  3. Set chatChannelId in defaultParams when it is constant for the run.
  4. Expose chatChannelId as required in the agent's tool schema.

Example fix

// before
await listTool._call({})
// after
await listTool._call({ chatChannelId: '19:chat...', teamId: 'team-guid' })
Defensive patterns

Strategy: validation

Validate before calling

function hasChatChannelId(params: any): boolean {
  return Boolean(params && params.chatChannelId)
}

Type guard

function isListMessagesArgs(a: unknown): a is { chatChannelId: string; teamId?: string } {
  return typeof a === 'object' && a !== null
    && typeof (a as any).chatChannelId === 'string' && (a as any).chatChannelId.length > 0
}

Try / catch

try {
  await listTool.call(arg)
} catch (e) {
  if (e instanceof Error && e.message === 'Chat or Channel ID is required') {
    // request chatChannelId
  } else throw e
}

Prevention

When it happens

Trigger: Calling ListMessages without chatChannelId; passing an empty/null chatChannelId; defaultParams not configured with it.

Common situations: Agent invokes the list tool without specifying which chat/channel to read; the chatChannelId variable resolved empty after an upstream failure; the node's input was left unbound.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/ba795a95c04ecfa1. Report an issue: GitHub.