Budibase/budibase · error · HTTPError

Slack app configuration token is not configured for this wor

Error message

Slack app configuration token is not configured for this workspace

What it means

fetchConfigToken decrypts and returns the workspace's Slack config token, rotating it via the refresh token when it is near expiry. If no SlackAppConfig document exists in the workspace DB or it has no configToken, this 400 HTTPError is thrown — the Slack app was never configured in this workspace.

Source

Thrown at packages/server/src/sdk/workspace/ai/slackAppConfig.ts:82

  const db = getWorkspaceDB()
  const next: SlackAppConfig = {
    ...existing,
    configToken: encodeSecret(rotated.configToken),
    refreshToken: encodeSecret(rotated.refreshToken),
    expiresAt: rotated.expiresAt,
    updatedAt: new Date().toISOString(),
  }
  const response = await db.put(next)
  return {
    ...next,
    _rev: response.rev,
  }
}

export const fetchConfigToken = async () => {
  const config = await fetch()
  if (!config?.configToken) {
    throw new HTTPError(
      "Slack app configuration token is not configured for this workspace",
      400
    )
  }

  if (!tokenNeedsRotation(config.expiresAt) && config.expiresAt) {
    return decodeSecret(config.configToken)
  }

  if (!config.refreshToken) {
    if (config.expiresAt) {
      throw new HTTPError(
        "Slack app configuration token has expired. Save a new config token and refresh token.",
        400
      )
    }
    return decodeSecret(config.configToken)
  }

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Save the Slack config token and refresh token via the Slack app config save endpoint/API first
  2. Confirm you are in the intended dev workspace (config docs are per-workspace)
  3. Check the workspace DB for the slack_app_config/config document and re-save if it is missing fields
  4. Re-run the Slack app setup wizard in the builder

Example fix

// before
const token = await fetchConfigToken() // throws: not configured
// after
const config = await fetch()
if (!config?.configToken) {
  await save(configToken, refreshToken) // configure first
}
const token = await fetchConfigToken()
Defensive patterns

Strategy: validation

Validate before calling

const config = await slackAppConfig.fetch()
if (!config?.configToken) {
  throw new Error("Slack config token missing; run save() first")
}

Type guard

const isConfigured = (
  config: SlackAppConfig | undefined
): config is SlackAppConfig & { configToken: string } =>
  typeof config?.configToken === "string" && config.configToken.length > 0

Try / catch

try {
  const token = await fetchConfigToken()
} catch (err) {
  if (err instanceof HTTPError && err.status === 400 && err.message.includes("not configured")) {
    // run the Slack app setup / save flow before proceeding
  } else { throw err }
}

Prevention

When it happens

Trigger: Calling fetchConfigToken (or any flow depending on it) in a workspace where save() was never called, or where the saved config has an empty configToken.

Common situations: New/cloned workspace where Slack config was never set up; config removed via remove(); config doc written without a token (e.g. only expiry fields); wrong workspace targeted.

Related errors


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