{"record":{"id":"07966f1af897e30c","repo":"Budibase/budibase","slug":"slack-app-configuration-token-is-not-configured-fo","errorCode":null,"errorMessage":"Slack app configuration token is not configured for this workspace","messagePattern":"Slack app configuration token is not configured for this workspace","errorType":"http","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/ai/slackAppConfig.ts","lineNumber":82,"sourceCode":"  const db = getWorkspaceDB()\n  const next: SlackAppConfig = {\n    ...existing,\n    configToken: encodeSecret(rotated.configToken),\n    refreshToken: encodeSecret(rotated.refreshToken),\n    expiresAt: rotated.expiresAt,\n    updatedAt: new Date().toISOString(),\n  }\n  const response = await db.put(next)\n  return {\n    ...next,\n    _rev: response.rev,\n  }\n}\n\nexport const fetchConfigToken = async () => {\n  const config = await fetch()\n  if (!config?.configToken) {\n    throw new HTTPError(\n      \"Slack app configuration token is not configured for this workspace\",\n      400\n    )\n  }\n\n  if (!tokenNeedsRotation(config.expiresAt) && config.expiresAt) {\n    return decodeSecret(config.configToken)\n  }\n\n  if (!config.refreshToken) {\n    if (config.expiresAt) {\n      throw new HTTPError(\n        \"Slack app configuration token has expired. Save a new config token and refresh token.\",\n        400\n      )\n    }\n    return decodeSecret(config.configToken)\n  }","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/ai/slackAppConfig.ts#L64-L100","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Save the Slack config token and refresh token via the Slack app config save endpoint/API first","Confirm you are in the intended dev workspace (config docs are per-workspace)","Check the workspace DB for the slack_app_config/config document and re-save if it is missing fields","Re-run the Slack app setup wizard in the builder"],"exampleFix":"// before\nconst token = await fetchConfigToken() // throws: not configured\n// after\nconst config = await fetch()\nif (!config?.configToken) {\n  await save(configToken, refreshToken) // configure first\n}\nconst token = await fetchConfigToken()","handlingStrategy":"validation","validationCode":"const config = await slackAppConfig.fetch()\nif (!config?.configToken) {\n  throw new Error(\"Slack config token missing; run save() first\")\n}","typeGuard":"const isConfigured = (\n  config: SlackAppConfig | undefined\n): config is SlackAppConfig & { configToken: string } =>\n  typeof config?.configToken === \"string\" && config.configToken.length > 0","tryCatchPattern":"try {\n  const token = await fetchConfigToken()\n} catch (err) {\n  if (err instanceof HTTPError && err.status === 400 && err.message.includes(\"not configured\")) {\n    // run the Slack app setup / save flow before proceeding\n  } else { throw err }\n}","preventionTips":["Complete the Slack app setup (save token + refresh token) before calling dependent flows","Check fetch() for a configToken before calling fetchConfigToken","Keep per-workspace config in mind — a configured workspace does not imply others are","Alert when fetch() returns null in a workspace expected to be configured"],"tags":["slack","token","configuration"],"backgroundTag":"missing-credential-config","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}