{"record":{"id":"112fdce7df9a6fb8","repo":"FlowiseAI/Flowise","slug":"members-list-is-required-to-create-a-chat","errorCode":null,"errorMessage":"Members list is required to create a chat","messagePattern":"Members list is required to create a chat","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/tools/MicrosoftTeams/core.ts","lineNumber":649,"sourceCode":"            schema: z.object({\n                chatType: z.enum(['oneOnOne', 'group']).optional().default('group').describe('Type of chat to create'),\n                topic: z.string().optional().describe('Topic/subject of the chat (for group chats)'),\n                members: z.string().describe('Comma-separated list of user IDs to add to the chat')\n            }),\n            baseUrl: BASE_URL,\n            method: 'POST',\n            headers: {}\n        }\n\n        super({ ...toolInput, accessToken: args.accessToken, defaultParams: args.defaultParams })\n    }\n\n    protected async _call(arg: any): Promise<string> {\n        const params = { ...arg, ...this.defaultParams }\n        const { chatType = 'group', topic, members } = params\n\n        if (!members) {\n            throw new Error('Members list is required to create a chat')\n        }\n\n        try {\n            const memberIds = members.split(',').map((id: string) => id.trim())\n            const chatMembers = memberIds.map((userId: string) => ({\n                '@odata.type': '#microsoft.graph.aadUserConversationMember',\n                'user@odata.bind': `https://graph.microsoft.com/v1.0/users('${userId}')`\n            }))\n\n            const body: any = {\n                chatType,\n                members: chatMembers\n            }\n\n            if (topic && chatType === 'group') {\n                body.topic = topic\n            }\n","sourceCodeStart":631,"sourceCodeEnd":667,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/MicrosoftTeams/core.ts#L631-L667","documentation":"Thrown synchronously by CreateChatTool._call when members is falsy after the params merge. Above the try block at core.ts:648, propagates as a raw Error. zod schema (core.ts:634) declares members as a required string — a comma-separated list of user IDs. Note the schema's chatType enum is ['oneOnOne','group'] while the default in _call (core.ts:646) is 'group', and topic is only attached for group chats (core.ts:664).","triggerScenarios":"create_chat invoked without members; defaultParams clobbering members to undefined; agent passing an array instead of a comma-separated string (would pass this check but fail at Graph); members string empty after trim.","commonSituations":"Agent forgetting to populate members; UI multi-select cleared; members passed as an array because the schema says 'list'; defaultParams misconfiguration; oneOnOne chat requested with wrong number of members (passes this check, fails downstream).","solutions":["Pass members as a non-empty comma-separated string of Azure AD user object IDs.","For oneOnOne chats pass exactly two IDs (yourself + the other user); for group chats pass 2+ IDs.","Validate the string splits into at least one non-empty ID before invoking.","Fix the params spread order.","Catch the propagated Error upstream."],"exampleFix":"// before — only checks truthiness, accepts '   ,   '\nif (!members) {\n    throw new Error('Members list is required to create a chat')\n}\n\n// after — validate at least one real ID is present\nconst memberIds = String(members ?? '').split(',').map((s) => s.trim()).filter(Boolean)\nif (memberIds.length === 0) {\n    throw new Error('Members list is required to create a chat')\n}","handlingStrategy":"validation","validationCode":"function validateCreateChatInput(input: unknown) {\n  const { members, chatType } = (input ?? {}) as any\n  if (typeof members !== 'string' || !members.trim()) {\n    throw new Error('members is required and must be a comma-separated string of user IDs')\n  }\n  const ids = members.split(',').map((s) => s.trim()).filter(Boolean)\n  if (ids.length === 0) throw new Error('members must contain at least one user ID')\n  if (chatType === 'oneOnOne' && ids.length !== 2) {\n    throw new Error('oneOnOne chat requires exactly two user IDs')\n  }\n  for (const id of ids) {\n    if (!/^[0-9a-f-]{36}$/i.test(id)) throw new Error(`userId ${id} is not a GUID`)\n  }\n}","typeGuard":"function isCreateChatArgs(x: unknown): x is { members: string; chatType?: 'oneOnOne' | 'group'; topic?: string } {\n  if (typeof x !== 'object' || x === null) return false\n  const o = x as any\n  if (typeof o.members !== 'string' || !o.members.trim()) return false\n  return o.members.split(',').map((s: string) => s.trim()).filter(Boolean).length > 0\n}","tryCatchPattern":"try {\n  if (!isCreateChatArgs(input)) return { error: 'comma-separated members string required' }\n  return JSON.parse((await createChatTool.invoke(input)).split(TOOL_ARGS_PREFIX)[0])\n} catch (e) {\n  return { error: (e as Error).message }\n}","preventionTips":["Pass members as a comma-separated string of Azure AD object IDs — not an array.","For oneOnOne chats include exactly two IDs (the signed-in user + the other party).","Topic is only applied to group chats — do not set it for oneOnOne.","Resolve any UPN/email to a GUID via /users first."],"tags":["validation","microsoft-teams","required-field","chat","create","members"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}