Budibase/budibase · error · HTTPError
Unsupported import data
Error message
Unsupported import data
What it means
When no `type` is given, RestImporter.init tries each registered source's tryLoad in turn; if none of them can parse the payload, importer.source remains unset and it throws HTTPError 400 'Unsupported import data'. The payload is neither a valid OpenAPI 2/3 document nor a curl command.
Source
Thrown at packages/server/src/api/controllers/query/import/index.ts:211
const factory = SOURCE_FACTORIES[type]
if (!factory) {
throw new HTTPError("Unsupported import type", 400)
}
const source = factory()
await source.load(data)
importer.source = source
return importer
} else {
for (let source of [new OpenAPI3(), new OpenAPI2(), new Curl()]) {
if (await source.tryLoad(data)) {
importer.source = source
break
}
}
}
if (!importer.source) {
throw new HTTPError("Unsupported import data", 400)
}
return importer
}
getSource = () => this.source
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 queriesView on GitHub (pinned to a81a902e9a)
Solutions
- Confirm the payload is a valid OpenAPI 2 (swagger 2.0) or OpenAPI 3 document, or a curl command
- Validate the spec with an external tool (swagger-cli validate / Redocly lint) and fix parse errors
- Export from your API tool as OpenAPI rather than Postman/RAML formats
- Convert a single request into a curl command as a fallback import path
Example fix
// before await RestImporter.init(JSON.stringify(postmanCollection)) // throws // after await RestImporter.init(yamlStringify(openapiSpec)) // valid openapi3.0 doc
Defensive patterns
Strategy: validation
Validate before calling
function looksLikeImportableSpec(data: string): boolean {
const t = data.trim()
if (t.startsWith("curl ")) return true
try {
const doc = JSON.parse(t)
return !!(doc.openapi?.startsWith("3") || doc.swagger === "2.0")
} catch {
return /(^|\n)openapi:\s*3|(^|\n)swagger:\s*["']?2/.test(t)
}
} Type guard
null
Try / catch
try {
await RestImporter.init(data)
} catch (e) {
if (String(e?.message).includes("Unsupported import data")) {
// surface: 'Not an OpenAPI 2/3 document or curl command'
}
throw e
} Prevention
- Verify with a linter (Redocly/swagger-cli) that the file is a valid OpenAPI 2/3 spec before import
- Convert Postman/RAML/GraphQL exports to OpenAPI first
- Ensure the paste didn't truncate large specs or mangle quotes
When it happens
Trigger: Auto-detect import with data that is arbitrary JSON (e.g. a Postman collection), plain HTTP snippets, XML/WADL, truncated YAML, or an empty string that slipped past validation.
Common situations: Users paste a Postman collection expecting OpenAPI import; a GraphQL schema pasted into the REST importer; a spec so malformed that both OpenAPI parsers reject it; exporting from a tool that produces RAML or API Blueprint.
Related errors
- Selected endpoint could not be imported
- 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/28f9ff517789093c.
Report an issue: GitHub.