{"record":{"id":"28f9ff517789093c","repo":"Budibase/budibase","slug":"unsupported-import-data","errorCode":null,"errorMessage":"Unsupported import data","messagePattern":"Unsupported import data","errorType":"http","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/api/controllers/query/import/index.ts","lineNumber":211,"sourceCode":"      const factory = SOURCE_FACTORIES[type]\n      if (!factory) {\n        throw new HTTPError(\"Unsupported import type\", 400)\n      }\n\n      const source = factory()\n      await source.load(data)\n      importer.source = source\n      return importer\n    } else {\n      for (let source of [new OpenAPI3(), new OpenAPI2(), new Curl()]) {\n        if (await source.tryLoad(data)) {\n          importer.source = source\n          break\n        }\n      }\n    }\n    if (!importer.source) {\n      throw new HTTPError(\"Unsupported import data\", 400)\n    }\n    return importer\n  }\n\n  getSource = () => this.source\n\n  getInfo = () => this.source.getInfo()\n\n  importQueries = async (\n    datasourceId: string,\n    selectedEndpointId?: string\n  ): Promise<ImportResult> => {\n    const filterIds = selectedEndpointId\n      ? new Set<string>([selectedEndpointId])\n      : undefined\n    const staticVariables =\n      await this.getDatasourceStaticVariables(datasourceId)\n    // construct the queries","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/api/controllers/query/import/index.ts#L193-L229","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nawait RestImporter.init(JSON.stringify(postmanCollection)) // throws\n// after\nawait RestImporter.init(yamlStringify(openapiSpec)) // valid openapi3.0 doc","handlingStrategy":"validation","validationCode":"function looksLikeImportableSpec(data: string): boolean {\n  const t = data.trim()\n  if (t.startsWith(\"curl \")) return true\n  try {\n    const doc = JSON.parse(t)\n    return !!(doc.openapi?.startsWith(\"3\") || doc.swagger === \"2.0\")\n  } catch {\n    return /(^|\\n)openapi:\\s*3|(^|\\n)swagger:\\s*[\"']?2/.test(t)\n  }\n}","typeGuard":"null","tryCatchPattern":"try {\n  await RestImporter.init(data)\n} catch (e) {\n  if (String(e?.message).includes(\"Unsupported import data\")) {\n    // surface: 'Not an OpenAPI 2/3 document or curl command'\n  }\n  throw e\n}","preventionTips":["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"],"tags":["validation","format","openapi","import"],"backgroundTag":"unsupported-import-format","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}