{"record":{"id":"28e77db30c893d0a","repo":"FlowiseAI/Flowise","slug":"topic-is-required-to-update-a-chat","errorCode":null,"errorMessage":"Topic is required to update a chat","messagePattern":"Topic is required to update a chat","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/tools/MicrosoftTeams/core.ts","lineNumber":711,"sourceCode":"            }),\n            baseUrl: BASE_URL,\n            method: 'PATCH',\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 { chatId, topic } = params\n\n        if (!chatId) {\n            throw new Error('Chat ID is required')\n        }\n\n        if (!topic) {\n            throw new Error('Topic is required to update a chat')\n        }\n\n        try {\n            const body = { topic }\n            const endpoint = `/chats/${chatId}`\n            await this.makeTeamsRequest(endpoint, 'PATCH', body)\n\n            return this.formatResponse(\n                {\n                    success: true,\n                    message: 'Chat updated successfully'\n                },\n                params\n            )\n        } catch (error) {\n            return this.formatResponse(`Error updating chat: ${error}`, params)\n        }\n    }","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/MicrosoftTeams/core.ts#L693-L729","documentation":"Thrown synchronously by UpdateChatTool._call when topic is falsy after the chatId check passes. Above the try block at core.ts:710, propagates as a raw Error. zod schema (core.ts:691) marks topic required. This is the only field update the tool exposes, so an empty topic is a no-op the tool refuses to send.","triggerScenarios":"update_chat invoked with chatId but empty/undefined topic; defaultParams.topic set to '' or undefined; agent thinking it can clear the topic by passing empty string.","commonSituations":"Agent calling update without specifying a topic; UI clearing the topic field; intent to remove the topic (not supported — Graph does not allow clearing group chat topic via this PATCH shape).","solutions":["Pass a non-empty topic string.","If the goal is to remove a topic, note Graph's PATCH /chats/{id} does not accept null topic — you cannot clear it via this tool.","Fix the params spread order.","Catch the propagated Error upstream."],"exampleFix":"// before\nif (!topic) {\n    throw new Error('Topic is required to update a chat')\n}\n\n// after — explicit trim and a structured failure for empty/whitespace\nif (!topic || !String(topic).trim()) {\n    throw new Error('Topic is required to update a chat')\n}","handlingStrategy":"validation","validationCode":"function validateUpdateChatTopic(input: unknown) {\n  const { topic } = (input ?? {}) as any\n  if (typeof topic !== 'string' || !topic.trim()) {\n    throw new Error('topic is required and must be a non-empty string')\n  }\n}","typeGuard":"function isNonEmptyTopic(x: unknown): x is string {\n  return typeof x === 'string' && x.trim() !== ''\n}","tryCatchPattern":"try {\n  if (!isNonEmptyTopic(input.topic)) return { error: 'topic required' }\n  return await updateChatTool.invoke(input)\n} catch (e) {\n  return { error: (e as Error).message }\n}","preventionTips":["Trim whitespace before validation — a string of spaces fails Graph anyway.","Confirm target chat is a group chat (oneOnOne chats have no topic).","Do not attempt to clear a topic — Graph does not support null topic on this endpoint."],"tags":["validation","microsoft-teams","required-field","chat","update","topic"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}