Budibase/budibase · error

Unable to connect

Error message

Unable to connect

What it means

datasources.save (update path) optionally re-validates connectivity unless skipConnectionCheck is set. If the check reports invalid it throws 'Unable to connect' (no detail appended here) and the datasource is not updated. This guards against persisting a broken connection config over a working one.

Source

Thrown at packages/builder/src/stores/builder/datasources.ts:277

  async save({
    integration,
    datasource,
    skipConnectionCheck,
  }: {
    integration: Integration
    datasource: Datasource
    skipConnectionCheck?: boolean
  }) {
    const existingDatasource = get(this.store).rawList.find(
      existing => existing._id === datasource._id
    )
    const isRename =
      !!existingDatasource && existingDatasource.name !== datasource.name
    if (
      !skipConnectionCheck &&
      !(await this.checkDatasourceValidity(integration, datasource)).valid
    ) {
      throw new Error("Unable to connect")
    }

    const response = await API.updateDatasource(datasource)
    const updatedDatasource = this.updateDatasourceInStore(response)
    if (isRename) {
      try {
        await Promise.all([
          agentsStore.fetchAgents(),
          workspaceDeploymentStore.fetch(),
        ])
      } catch (error) {
        console.error("Failed to refresh agents after datasource rename", error)
      }
    }
    return updatedDatasource
  }

  async deleteDatasource(datasource: Datasource) {

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Fix the connection settings so the validity check passes, then save.
  2. If only renaming and the DB is transiently down, wait for the DB to recover or pass skipConnectionCheck if the flow supports it.
  3. Confirm reachability/credentials as in the create flow (host, port, auth, TLS).

Example fix

// before
await datasourceStore.save(datasource) // fails while DB is briefly down
// after
await datasourceStore.save(datasource, { skipConnectionCheck: true }) // rename-only save
Defensive patterns

Strategy: try-catch

Validate before calling

if (!skipConnectionCheck) {
  const { valid, error } = await datasourceStore.checkDatasourceValidity(integration, datasource)
  if (!valid) {
    showConnectionErrorDialog(error)
    return
  }
}

Type guard

const isConnectivityError = (e: unknown): e is Error =>
  e instanceof Error && e.message === "Unable to connect"

Try / catch

try {
  await datasourceStore.save(datasource)
} catch (e) {
  if (e instanceof Error && e.message === "Unable to connect") {
    promptRetryOrForce({ onRetry: () => datasourceStore.save(datasource), onSkip: () => datasourceStore.save(datasource, { skipConnectionCheck: true }) })
    return
  }
  throw e
}

Prevention

When it happens

Trigger: Saving datasource edits (rename, config change) without skipConnectionCheck when the checkDatasourceValidity probe fails — same causes as creation but triggered on update; also occurs when merely renaming a datasource whose DB has meanwhile gone offline.

Common situations: Renaming a datasource while its database is temporarily unreachable; editing credentials with a typo; environment drift where prod DB is unreachable from the builder session.

Related errors


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