{"record":{"id":"0b82591435622012","repo":"Budibase/budibase","slug":"teams-integration-is-not-configured-for-this-agent","errorCode":null,"errorMessage":"Teams integration is not configured for this agent","messagePattern":"Teams integration is not configured for this agent","errorType":"http","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/ai/deployments/ms-teams.ts","lineNumber":41,"sourceCode":"const normalisePackageSegment = (value: string) =>\n  value\n    .trim()\n    .toLowerCase()\n    .replace(/[^a-z0-9]+/g, \"\") || \"agent\"\n\nconst normaliseDescription = (description?: string) =>\n  description?.trim() || DEFAULT_DESCRIPTION\n\nconst getOrigin = (url: string) => new URL(url).origin\n\nconst getHostname = (url: string) => new URL(url).hostname\n\nexport const validateMSTeamsIntegration = (\n  agent: Agent\n): ResolvedMSTeamsIntegration => {\n  const integration = agent.MSTeamsIntegration\n  if (!integration) {\n    throw new HTTPError(\n      \"Teams integration is not configured for this agent\",\n      400\n    )\n  }\n\n  const appId = integration.appId?.trim()\n  const appPassword = integration.appPassword?.trim()\n  const tenantId = integration.tenantId?.trim()\n\n  if (!appId || !appPassword || !tenantId) {\n    throw new HTTPError(\n      \"Teams integration requires appId (client ID) and appPassword (client secret value)\",\n      400\n    )\n  }\n\n  if (!isValidUUID(appId)) {\n    throw new HTTPError(\"Teams integration appId must be a valid UUID\", 400)","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/ai/deployments/ms-teams.ts#L23-L59","documentation":"validateMSTeamsIntegration resolves an agent's Microsoft Teams deployment configuration. If the agent has no MSTeamsIntegration object at all, there is nothing to validate or deploy, so it throws HTTP 400 before touching appId/appPassword.","triggerScenarios":"Deploying or invoking an MS Teams agent (integration flow that calls validateMSTeamsIntegration) where agent.MSTeamsIntegration is undefined — the agent was created without Teams config, or the integration object was removed/not synced when the agent was loaded.","commonSituations":"Agent saved via API/script omitting the MSTeamsIntegration field; attempting a Teams deployment on an agent configured only for other channels; partial agent fetch dropping the integration field.","solutions":["Add the MSTeamsIntegration object (appId, appPassword, tenantId) to the agent before deploying.","Re-save/re-fetch the agent to confirm the integration field is present in the loaded document.","Guard the deployment path: only call the Teams deployment for agents with a configured Teams integration."],"exampleFix":"// before\nawait deployMSTeams(agent) // agent has no MSTeamsIntegration\n// after\nif (!agent.MSTeamsIntegration) {\n  agent = await api.saveAgent({ ...agent, MSTeamsIntegration: { appId, appPassword, tenantId } })\n}\nawait deployMSTeams(agent)","handlingStrategy":"type-guard","validationCode":"if (!agent.MSTeamsIntegration) {\n  throw new Error(\"Agent must have MSTeamsIntegration configured before Teams deployment\")\n}","typeGuard":"function hasTeamsIntegration(a: Agent): a is Agent & { MSTeamsIntegration: ResolvedMSTeamsIntegration } {\n  return Boolean(a.MSTeamsIntegration)\n}","tryCatchPattern":"try {\n  const integration = validateMSTeamsIntegration(agent)\n} catch (e) {\n  if (e.status === 400 && e.message.includes(\"not configured\")) {\n    // route user to Teams integration setup instead of deploying\n    return { configured: false }\n  }\n  throw e\n}","preventionTips":["Check for MSTeamsIntegration in the UI before enabling Teams channel deployment.","Ensure agent save endpoints persist the integration object atomically.","Only surface Teams deployment actions for agents with configured integrations."],"tags":["validation","ms-teams","agent-config","http-400"],"backgroundTag":"missing-configuration","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}