Budibase/budibase · error · Error
Selected endpoint could not be imported
Error message
Selected endpoint could not be imported
What it means
During import of a REST definition, when a filterIds set is supplied only those endpoints are returned by source.getQueries. If filtering leaves zero queries, the importer throws 'Selected endpoint could not be imported' — meaning none of the selected endpoints exist in or survived parsing of the source document.
Source
Thrown at packages/server/src/api/controllers/query/import/index.ts:236
getInfo = () => this.source.getInfo()
importQueries = async (
datasourceId: string,
selectedEndpointId?: string
): Promise<ImportResult> => {
const filterIds = selectedEndpointId
? new Set<string>([selectedEndpointId])
: undefined
const staticVariables =
await this.getDatasourceStaticVariables(datasourceId)
// construct the queries
let queries = this.source.getQueries(datasourceId, {
filterIds,
staticVariables,
})
if (filterIds && queries.length === 0) {
throw new Error("Selected endpoint could not be imported")
}
// validate queries
const errorQueries: Query[] = []
const schema = queryValidation()
queries = queries
.filter(query => {
const validation = schema.validate(query)
if (validation.error) {
errorQueries.push(query)
return false
}
return true
})
.map(query => {
query._id = generateQueryID(query.datasourceId)
return query
})View on GitHub (pinned to a81a902e9a)
Solutions
- Re-fetch the import info/endpoints from the current spec and re-select before importing
- Log and compare the filterIds against the endpoints returned by getImportInfo to find stale IDs
- Fix your code so filterIds are derived from the same source instance that performs the import
Example fix
// before
const { endpoints } = await getImportInfo(oldInput) // stale
await importer.importQueries(dsId, { filterIds: new Set(oldIds) })
// after
const { endpoints } = await getImportInfo(currentInput)
const filterIds = new Set(endpoints.map(e => e.id))
await importer.importQueries(dsId, { filterIds }) Defensive patterns
Strategy: validation
Validate before calling
const info = await getImportInfo(input)
const validIds = new Set(info.endpoints.map(e => e.id))
const stale = [...filterIds].filter(id => !validIds.has(id))
if (stale.length) throw new Error(`Selected endpoints no longer exist: ${stale.join(", ")}`) Type guard
null
Try / catch
try {
await importer.importQueries(datasourceId, { filterIds })
} catch (e) {
if (String(e?.message).includes("Selected endpoint could not be imported")) {
// refresh endpoint list and ask user to re-select
}
throw e
} Prevention
- Always derive filterIds from a getImportInfo call on the same spec version you import from
- Invalidate cached endpoint lists whenever the spec changes
- Don't persist endpoint IDs across spec re-imports without re-validating them
When it happens
Trigger: Calling importQueries (or the importer flow) with filterIds referencing endpoint IDs that are not present in the loaded spec — typically after the spec changed between the listing step and the import step, or IDs were built with a different serialization.
Common situations: The UI cached the endpoint list, the spec was updated/renamed on the server, then the user imported; importing selected endpoints from a re-fetched spec whose operation paths changed; hand-crafted filterIds that never matched.
Related errors
- Unsupported import data
- Failed to load OpenAPI 3 document
- Invalid import url
- Only HTTP(S) URLs are allowed for query import
- Import url must not contain credentials
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/973c457b6a4c9c12.
Report an issue: GitHub.