Budibase/budibase · error
Unable to connect - ${error}
Error message
Unable to connect - ${error} What it means
datasources.create first checks connectivity with checkDatasourceValidity using the integration's verification logic. If the datasource cannot connect (valid === false) it throws 'Unable to connect - <error>', where error is the underlying reason (host unreachable, auth failed, bad URL, etc.). No datasource is created on failure.
Source
Thrown at packages/builder/src/stores/builder/datasources.ts:248
const datasource: Datasource = {
type: "datasource",
source: integration.name as SourceName,
config,
name: `${name || integration.friendlyName}${nameModifier}`,
projectIds,
plus: integration.plus && integration.name !== SourceName.REST,
isSQL: integration.isSQL,
...(restTemplateId && { restTemplateId }),
...(restTemplateVersion && { restTemplateVersion }),
}
const { valid, error } = await this.checkDatasourceValidity(
integration,
datasource
)
if (!valid) {
throw new Error(`Unable to connect - ${error}`)
}
const response = await API.createDatasource({
datasource,
fetchSchema: integration.plus,
})
return this.updateDatasourceInStore(response, { ignoreErrors: true })
}
async save({
integration,
datasource,
skipConnectionCheck,
}: {
integration: Integration
datasource: Datasource
skipConnectionCheck?: booleanView on GitHub (pinned to a81a902e9a)
Solutions
- Read the appended <error> detail and fix the connection config (host, port, user, password, database).
- Verify the database is running and reachable from the Budibase server/worker (not just your machine).
- Test credentials with a direct client (psql/mysql client) from the server host.
- Check TLS/SSL settings if the database enforces encrypted connections.
Example fix
// before
{ config: { host: "localhost", port: 5432 } } // server-side cannot reach localhost
// after
{ config: { host: "postgres.internal", port: 5432, user: "bb", password: "...", database: "app" } } Defensive patterns
Strategy: validation
Validate before calling
// validate config fields before calling create
const { valid, error } = await datasourceStore.checkDatasourceValidity(integration, datasource)
if (!valid) {
showConnectionErrorDialog(error)
return
} Type guard
const hasConnectionConfig = (d: Datasource): d is Datasource & { config: { host: string; port: number } } =>
!!d.config && typeof (d.config as { host?: string }).host === "string" && typeof (d.config as { port?: number }).port === "number" Try / catch
try {
await datasourceStore.create(datasource)
} catch (e) {
if (e.message.startsWith("Unable to connect")) {
showConnectionTroubleshooter(e.message.replace("Unable to connect - ", ""))
return
}
throw e
} Prevention
- Test the connection with the built-in validity check before create.
- Verify DB reachability from the server host (not just the browser machine).
- Double-check host, port, credentials, and TLS settings; watch the appended error detail.
- In containerized setups, use service hostnames instead of localhost.
When it happens
Trigger: Creating a datasource whose target database rejects/ fails the connectivity check — wrong host/port, database down, invalid credentials, bad connection string, or network/firewall blocking the server-side connection.
Common situations: Typo'd host or port; SSL/TLS requirements not met; DB only reachable from certain networks; expired credentials; Docker networking where 'localhost' points at the wrong container.
Related errors
- Unable to connect
- Error getting account by tenantId ${tenantId}
- Error getting status
- ${err.message}
- Unable to remove doc without a valid _id and _rev.
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/3e1a4741b4620842.
Report an issue: GitHub.