Budibase/budibase · error · HTTPError
Unsupported import type
Error message
Unsupported import type
What it means
RestImporter.init accepts an explicit `type` and looks it up in SOURCE_FACTORIES, which only knows 'openapi2.0', 'openapi3.0', and 'curl'. If a type string is supplied that has no factory, it throws HTTPError 400 'Unsupported import type'.
Source
Thrown at packages/server/src/api/controllers/query/import/index.ts:195
importer.getSource().getImportSource(),
cache.TTL.ONE_DAY * OPENAPI_SPEC_CACHE_TTL_DAYS
)
}
return importer
}
export class RestImporter {
private source!: ImportSource
private constructor() {}
static init = async (data: string, type?: string) => {
const importer = new RestImporter()
if (type) {
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 importerView on GitHub (pinned to a81a902e9a)
Solutions
- Use one of the supported exact type strings: 'openapi2.0', 'openapi3.0', or 'curl'
- Omit the `type` argument entirely to let init auto-detect the format from the data
- Normalize/case the type string before calling (keys are lowercase, exact match)
Example fix
// before await RestImporter.init(data, "openapi3") // throws // after await RestImporter.init(data, "openapi3.0") // or auto-detect: await RestImporter.init(data)
Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED_TYPES = ["openapi2.0", "openapi3.0", "curl"] as const type ImportType = typeof SUPPORTED_TYPES[number] const isSupportedType = (t: string): t is ImportType => (SUPPORTED_TYPES as readonly string[]).includes(t.toLowerCase())
Type guard
const isImportType = (t: string): t is "openapi2.0" | "openapi3.0" | "curl" => ["openapi2.0", "openapi3.0", "curl"].includes(t)
Try / catch
null
Prevention
- Only pass types from the server's exact key set (lowercase, versioned like 'openapi3.0')
- Omit the type parameter to rely on auto-detection when unsure
- Map your client-side type labels to the server keys in one shared constant
When it happens
Trigger: Calling RestImporter.init(data, type) with type values like 'openapi', 'swagger', 'OpenAPI3.0' (wrong case), 'postman', or 'graphql'.
Common situations: Client sends a type label from its own enum that doesn't match the server's keys; after a version change the type naming shifted (e.g. 'openapi2.0' vs 'openapi2'); passing a MIME type like 'application/json' instead of the importer name.
Related errors
- Import data or url is required
- Invalid import url
- Only HTTP(S) URLs are allowed for query import
- Import url must not contain credentials
- Unsupported import data
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/e35056b023c4f87e.
Report an issue: GitHub.