FlowiseAI/Flowise · error · Error
Team ID is required to list channels
Error message
Team ID is required to list channels
What it means
Thrown synchronously by ListChannelsTool._call when teamId is falsy after merging the tool args with defaultParams. Because the throw sits above the try block at core.ts:101, it propagates out of _call as a real rejection rather than being converted into a formatResponse error string. The schema at core.ts:86 declares teamId as z.string() (non-optional), so a well-behaved zod-validated caller cannot trigger this — it fires only when defaultParams overrides teamId to undefined, when the schema is bypassed, or when an LLM agent sends malformed tool input.
Source
Thrown at packages/components/nodes/tools/MicrosoftTeams/core.ts:102
description: 'List all channels in a team',
schema: z.object({
teamId: z.string().describe('ID of the team to list channels from'),
maxResults: z.number().optional().default(50).describe('Maximum number of channels 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 { teamId, maxResults = 50 } = params
if (!teamId) {
throw new Error('Team ID is required to list channels')
}
try {
const endpoint = `/teams/${teamId}/channels`
const result = await this.makeTeamsRequest(endpoint)
// Filter results to maxResults on client side since $top is not supported
const channels = result.value || []
const limitedChannels = channels.slice(0, maxResults)
const responseData = {
success: true,
channels: limitedChannels,
count: limitedChannels.length,
total: channels.length
}
return this.formatResponse(responseData, params)View on GitHub (pinned to abe4a8601a)
Solutions
- Confirm the tool input includes a non-empty teamId string before invoking.
- Fix defaultParams semantics: the spread { ...arg, ...this.defaultParams } means defaultParams WINS — invert to { ...this.defaultParams, ...arg } so caller args take precedence, or stop putting teamId in defaultParams.
- If you genuinely want a default team, put it in defaultParams but ensure the caller omits teamId rather than passing undefined.
- Wrap the call site in try/catch since this throw escapes the tool.
Example fix
// before — defaultParams silently overrides caller
const params = { ...arg, ...this.defaultParams } // defaultParams wins
// after — caller args win, defaults only fill gaps
const params = { ...this.defaultParams, ...arg } Defensive patterns
Strategy: validation
Validate before calling
function validateListChannelsInput(input: unknown): asserts input is { teamId: string } {
if (typeof input !== 'object' || input === null) throw new Error('input required')
const { teamId } = input as any
if (typeof teamId !== 'string' || !teamId.trim()) {
throw new Error('teamId is required and must be a non-empty string')
}
} Type guard
function isListChannelsArgs(x: unknown): x is { teamId: string; maxResults?: number } {
return typeof x === 'object' && x !== null &&
typeof (x as any).teamId === 'string' && (x as any).teamId.trim() !== ''
} Try / catch
try {
if (!isListChannelsArgs(input)) {
return { error: 'teamId required' }
}
return await listChannelsTool.invoke(input)
} catch (e) {
// validation throws above escape the tool — handle at orchestration
log.warn('list_channels validation failed', { error: e })
return { error: (e as Error).message }
} Prevention
- Validate IDs at the orchestration layer before invoking the tool — do not rely on zod alone because defaultParams can clobber values post-validation.
- Audit defaultParams: any key present there overrides caller args due to the { ...arg, ...this.defaultParams } spread.
- Resolve teamId from a prior list_teams call rather than accepting free-text from end users.
- Add unit tests that call _call with the minimal expected input to catch regressions.
When it happens
Trigger: Caller invokes list_channels without teamId; defaultParams contains { teamId: undefined } which overwrites the arg via the { ...arg, ...this.defaultParams } spread at core.ts:98; LangChain agent bypasses zod parsing; the tool is invoked directly in tests with an empty object.
Common situations: defaultParams set globally with teamId: '' or undefined intended as 'use agent value' but actually clobbering it; agent prompt not telling the model teamId is required; CI test that constructs the tool and calls _call({}) directly.
Related errors
- Both Team ID and Channel ID are required
- Team ID and Display Name are required to create a channel
- Team ID, Channel ID, and User ID are all required
- Chat ID is required
- Members list is required to create a chat
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/2c9f50a792c340ac.
Report an issue: GitHub.