Budibase/budibase · error · Error

Slack OAuth client credentials are not configured

Error message

Slack OAuth client credentials are not configured

What it means

Before exchanging the OAuth code, the handler reads clientId and clientSecret from the agent's slackIntegration config. If either is missing/blank it throws this Error — the agent was provisioned without complete Slack client credentials, so the code-for-token exchange with Slack cannot authenticate.

Source

Thrown at packages/server/src/api/controllers/ai/agents.ts:600

    throw new Error("Slack OAuth state is invalid or expired")
  }

  const oauthError = String(ctx.query.error || "").trim()
  if (oauthError) {
    throw new Error("Slack OAuth authorization failed")
  }

  const code = String(ctx.query.code || "").trim()
  if (!code) {
    throw new Error("Slack OAuth callback is missing the authorization code")
  }

  await context.doInWorkspaceContext(statePayload.workspaceId, async () => {
    const agent = await sdk.ai.agents.getOrThrow(statePayload.agentId)
    const clientId = agent.slackIntegration?.clientId?.trim()
    const clientSecret = agent.slackIntegration?.clientSecret?.trim()
    if (!clientId || !clientSecret) {
      throw new Error("Slack OAuth client credentials are not configured")
    }

    const redirectUri = await getSlackOAuthRedirectUrl()
    const token = await sdk.ai.deployments.slack.exchangeSlackOAuthCode({
      code,
      clientId,
      clientSecret,
      redirectUri,
    })
    const botToken = token.access_token?.trim()
    if (!botToken) {
      throw new Error("Slack OAuth response did not include a bot token")
    }

    const updatedAgent = await sdk.ai.agents.update({
      ...agent,
      slackIntegration: {
        ...agent.slackIntegration,

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Re-run the Slack app creation flow for this agent so clientId/clientSecret are stored on slackIntegration
  2. Verify the agent document in the database has non-empty slackIntegration.clientId and clientSecret
  3. Check that sdk.ai.agents.update after app creation persisted the credentials (no failed write swallowed)
  4. Confirm the state payload references the correct agentId

Example fix

// before
slackIntegration: { signingSecret: "..." }
// after
slackIntegration: { clientId: "123.456", clientSecret: "abc", signingSecret: "..." }
Defensive patterns

Strategy: validation

Validate before calling

const clientId = agent.slackIntegration?.clientId?.trim()
const clientSecret = agent.slackIntegration?.clientSecret?.trim()
if (!clientId || !clientSecret) {
  // re-run the Slack app creation flow before allowing OAuth callbacks
  throw new Error("Agent is missing Slack client credentials; recreate the Slack app first")
}

Type guard

function hasSlackCredentials(s: { clientId?: string; clientSecret?: string } | undefined): s is { clientId: string; clientSecret: string } {
  return !!s?.clientId?.trim() && !!s?.clientSecret?.trim()
}

Try / catch

try {
  await completeSlackOAuth(ctx)
} catch (err) {
  if (err.message.includes("client credentials are not configured")) {
    // trigger app re-creation for this agent, then ask the user to retry install
  } else { throw err }
}

Prevention

When it happens

Trigger: Callback processed for an agent whose slackIntegration lacks clientId or clientSecret — app creation step [193] partially persisted, credentials cleared by an update, or the state payload's agentId points at an agent configured by other means.

Common situations: Slack app creation completed but secrets never saved back onto the agent; an agent update overwrote slackIntegration; agent created manually/imported without credentials; doInWorkspaceContext resolving a different agent than intended.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/3503c029d9b38906. Report an issue: GitHub.