{"record":{"id":"3b9f5063cc06582d","repo":"usebruno/bruno","slug":"import-collection-failed-err-message-3b9f50","errorCode":null,"errorMessage":"Import collection failed: ${err.message}","messagePattern":"Import collection failed: (.+?)","errorType":"exception","errorClass":"BrunoError","httpStatus":null,"severity":"error","filePath":"packages/bruno-app/src/utils/importers/openapi-collection.js","lineNumber":9,"sourceCode":"import { BrunoError } from 'utils/common/error';\nimport { openApiToBruno } from '@usebruno/converters';\n\nexport const convertOpenapiToBruno = (data, options = {}) => {\n  try {\n    return openApiToBruno(data, options);\n  } catch (err) {\n    console.error('Error converting OpenAPI to Bruno:', err);\n    throw new BrunoError('Import collection failed: ' + err.message);\n  }\n};\n\nexport const isOpenApiSpec = (data) => {\n  if (!data || typeof data !== 'object') {\n    return false;\n  }\n\n  if (typeof data.info !== 'object' || data.info === null) {\n    return false;\n  }\n\n  if (typeof data.openapi === 'string' && data.openapi.trim().length) {\n    return true;\n  }\n\n  if (typeof data.swagger === 'string' && data.swagger.trim().length) {\n    return true;","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-app/src/utils/importers/openapi-collection.js#L1-L27","documentation":"Thrown by convertOpenapiToBruno when the @usebruno/converters openApiToBruno() function throws. Generic prefix wraps the original converter error which is also console.error-ed.","triggerScenarios":"An OpenAPI spec that isOpenApiSpec accepted but the converter cannot transform: invalid OpenAPI 3.x structure, missing paths, $ref resolution failures, unsupported content types, or malformed operation definitions.","commonSituations":"Swagger 2.0 spec passed to an OpenAPI 3 converter, specs with external $refs that cannot be resolved, circular refs, or specs exported by tools producing non-standard extensions.","solutions":["Read the console.error to find the underlying converter message.","Validate the spec with a tool like Spectral or swagger-cli before importing.","Inline external $refs or remove unsupported features.","Update @usebruno/converters and retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!isOpenApiSpec(data)) {\n  throw new Error('Not a recognized OpenAPI spec');\n}","typeGuard":"function isOpenApiSpec(data) {\n  if (!data || typeof data !== 'object') return false;\n  if (typeof data.info !== 'object' || data.info === null) return false;\n  return Boolean(data.openapi || data.swagger);\n}","tryCatchPattern":"try {\n  convertOpenapiToBruno(data);\n} catch (err) {\n  console.error('Original converter error:', err);\n  throw err;\n}","preventionTips":["Validate the spec with Spectral/swagger-cli before importing.","Inline external $refs and remove unsupported features.","Run isOpenApiSpec first to fail with a precise message."],"tags":["import","openapi","converter","collection"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}