FlowiseAI/Flowise · error · Error

Both Team ID and Channel ID are required

Error message

Both Team ID and Channel ID are required

What it means

Thrown synchronously by GetChannelTool._call when teamId or channelId is falsy after the params merge. Sits above the try block at core.ts:148 so it propagates as a real Error, not a formatResponse string. The zod schema at core.ts:132 marks both fields as required z.string(), so under normal LangChain invocation this is unreachable; it triggers when defaultParams clobbers a value to undefined or when the tool is called bypassing schema validation.

Source

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

            description: 'Get details of a specific channel',
            schema: z.object({
                teamId: z.string().describe('ID of the team that contains the channel'),
                channelId: z.string().describe('ID of the channel to retrieve')
            }),
            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, channelId } = params

        if (!teamId || !channelId) {
            throw new Error('Both Team ID and Channel ID are required')
        }

        try {
            const endpoint = `/teams/${teamId}/channels/${channelId}`
            const result = await this.makeTeamsRequest(endpoint)

            return this.formatResponse(
                {
                    success: true,
                    channel: result
                },
                params
            )
        } catch (error) {
            return this.formatResponse(`Error getting channel: ${error}`, params)
        }
    }
}

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Ensure both teamId and channelId are passed as non-empty strings.
  2. Invert the params spread to { ...this.defaultParams, ...arg } so explicit caller values are not overwritten by defaults.
  3. Add a preflight check at the call site: if (!teamId || !channelId) return badRequest.
  4. Catch the thrown Error at the orchestration layer since it escapes _call's internal try/catch.

Example fix

// before
const params = { ...arg, ...this.defaultParams }

// after — caller-supplied IDs always win
const params = { ...this.defaultParams, ...arg }
Defensive patterns

Strategy: validation

Validate before calling

function validateGetChannelInput(input: unknown) {
  if (!input || typeof input !== 'object') throw new Error('input required')
  const { teamId, channelId } = input as any
  for (const [k, v] of Object.entries({ teamId, channelId })) {
    if (typeof v !== 'string' || !v.trim()) {
      throw new Error(`${k} is required`)
    }
  }
}

Type guard

function isGetChannelArgs(x: unknown): x is { teamId: string; channelId: string } {
  return typeof x === 'object' && x !== null &&
    typeof (x as any).teamId === 'string' && (x as any).teamId.trim() !== '' &&
    typeof (x as any).channelId === 'string' && (x as any).channelId.trim() !== ''
}

Try / catch

try {
  if (!isGetChannelArgs(input)) return { error: 'teamId and channelId required' }
  return await getChannelTool.invoke(input)
} catch (e) {
  log.warn('get_channel validation failed', { error: e })
  return { error: (e as Error).message }
}

Prevention

When it happens

Trigger: get_channel invoked with only teamId or only channelId; defaultParams override one of the two to undefined; agent omits a field; direct _call({ teamId: 'x' }) in a test.

Common situations: defaultParams configured with channelId for one channel but reused against a different team; LLM agent hallucinating that channelId alone is enough; UI form submitting only one of two required fields.

Related errors


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