{"record":{"id":"45b4e8c22d924627","repo":"FlowiseAI/Flowise","slug":"message-is-not-pinned-in-this-chat","errorCode":null,"errorMessage":"Message is not pinned in this chat","messagePattern":"Message is not pinned in this chat","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/components/nodes/tools/MicrosoftTeams/core.ts","lineNumber":993,"sourceCode":"        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, messageId } = params\n\n        if (!chatId || !messageId) {\n            throw new Error('Both Chat ID and Message ID are required')\n        }\n\n        try {\n            // First get the pinned messages to find the pinned message ID\n            const pinnedEndpoint = `/chats/${chatId}/pinnedMessages`\n            const pinnedResult = await this.makeTeamsRequest(pinnedEndpoint)\n\n            const pinnedMessage = pinnedResult.value?.find((pm: any) => pm.message?.id === messageId)\n            if (!pinnedMessage) {\n                throw new Error('Message is not pinned in this chat')\n            }\n\n            const endpoint = `/chats/${chatId}/pinnedMessages/${pinnedMessage.id}`\n            await this.makeTeamsRequest(endpoint, 'DELETE')\n\n            return this.formatResponse(\n                {\n                    success: true,\n                    message: 'Message unpinned successfully'\n                },\n                params\n            )\n        } catch (error) {\n            return this.formatResponse(`Error unpinning message: ${error}`, params)\n        }\n    }\n}\n","sourceCodeStart":975,"sourceCodeEnd":1011,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/MicrosoftTeams/core.ts#L975-L1011","documentation":"Thrown by UnpinChatMessage after it successfully lists pinned messages at GET /chats/{chatId}/pinnedMessages but finds no record whose message.id matches the supplied messageId. This is a conditional runtime error indicating the message is not currently pinned, so there is nothing to unpin.","triggerScenarios":"Calling UnpinChatMessage for a message that was never pinned or was already unpinned; messageId refers to a message in a different chat; the pinned list is stale because another client unpinned it.","commonSituations":"Idempotent retry of an unpin that already succeeded; agent confused about which message was pinned; cross-chat messageId mismatch.","solutions":["Treat this as benign if the goal is to ensure the message is not pinned (idempotent).","Call a list-pinned-messages tool first to confirm the message is pinned before unpinning.","Verify the messageId belongs to the given chatId.","Refresh the pinned list before retrying to avoid stale state."],"exampleFix":"// before: blind unpin\nawait unpinTool._call({ chatId, messageId })\n// after: verify pinned first\nconst pinned = JSON.parse(await listPinnedTool._call({ chatId }))\nconst isPinned = pinned.some(pm => pm.message?.id === messageId)\nif (isPinned) await unpinTool._call({ chatId, messageId })","handlingStrategy":"validation","validationCode":"async function isMessagePinned(listPinnedTool: any, chatId: string, messageId: string): Promise<boolean> {\n  const res = await listPinnedTool.call({ chatId })\n  const arr = JSON.parse(res)\n  const list = Array.isArray(arr) ? arr : arr.value\n  return Array.isArray(list) && list.some((pm: any) => pm.message?.id === messageId)\n}","typeGuard":"null","tryCatchPattern":"try {\n  await unpinTool.call({ chatId, messageId })\n} catch (e) {\n  if (e instanceof Error && e.message === 'Message is not pinned in this chat') {\n    // already unpinned: treat as success (idempotent)\n  } else throw e\n}","preventionTips":["Treat unpin as idempotent.","Verify the messageId belongs to the given chatId.","Refresh the pinned list before retrying."],"tags":["microsoft-teams","graph-api","conditional","state-mismatch"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}