{"record":{"id":"ca26eae9c419d5ef","repo":"usebruno/bruno","slug":"unknown-error-ca26ea","errorCode":null,"errorMessage":"Unknown error","messagePattern":"Unknown error","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-converters/src/openapi/swagger2-to-bruno.js","lineNumber":653,"sourceCode":"        }\n        return folder;\n      });\n\n      let ungroupedItems = ungroupedRequests.map((req) => transformSwaggerRequestItem(req, usedNames, options));\n      brunoCollection.items = brunoFolders.concat(ungroupedItems);\n    }\n\n    // Collection-level auth\n    let collectionAuth = buildCollectionAuth(securityConfig.supported[0]);\n    brunoCollection.root = {\n      request: { auth: collectionAuth },\n      meta: { name: brunoCollection.name },\n      docs: toSpecString(collectionData.info?.description)\n    };\n\n    return brunoCollection;\n  } catch (err) {\n    if (!(err instanceof Error)) throw new Error('Unknown error');\n    throw err;\n  }\n};\n\n/**\n * Public API: Swagger 2.0 spec → validated Bruno collection\n * @param {Object} swaggerSpec - The Swagger 2.0 specification object\n * @param {Object} options - Import options\n * @returns {Object} Validated Bruno collection\n */\nexport const swagger2ToBruno = (swaggerSpec, options = {}) => {\n  try {\n    const collection = parseSwagger2Collection(swaggerSpec, options);\n    const transformedCollection = transformItemsInCollection(collection);\n    const hydratedCollection = hydrateSeqInCollection(transformedCollection);\n    const validatedCollection = validateSchema(hydratedCollection);\n    return validatedCollection;\n  } catch (err) {","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-converters/src/openapi/swagger2-to-bruno.js#L635-L671","documentation":"Thrown by the catch block of parseSwagger2Collection when an exception inside Swagger 2.0 parsing is NOT an instance of Error. The library uses this as a defensive guard: real Errors are rethrown as-is, but a non-Error throwable (string, plain object, or null) is normalized into a generic 'Unknown error'. The original cause is upstream in the parse pipeline; this message only surfaces when something threw a non-Error value.","triggerScenarios":"Any code path inside parseSwagger2Collection (or the functions it calls: buildCollectionAuth, transformSwaggerRequestItem, security resolution) that executes `throw <non-Error>` — e.g. a dependency throwing a string, a yup/array validation rejecting with a plain object, or an assertion library throwing a non-Error. It also fires if a Promise reject with a non-Error propagates synchronously into the try block.","commonSituations":"A malformed Swagger 2.0 spec where a deeply nested helper throws a raw string instead of an Error; third-party validators (ajv, yup) configured to throw plain objects; older Node behavior where certain native modules reject with strings.","solutions":["Inspect the upstream call chain in parseSwagger2Collection and replace any `throw 'msg'` / `throw {..}` with `throw new Error(...)` so the real message survives.","Reproduce with the exact swaggerSpec input and add a `console.error(err)` before line 653 to capture the non-Error value's shape.","If you control the caller, ensure all rejected values are Error instances before they reach this function."],"exampleFix":"// before (upstream helper)\nif (!spec.host) throw 'Missing host';\n\n// after\nif (!spec.host) throw new Error('Swagger spec is missing required field: host');","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const isError = (e) => e instanceof Error;","tryCatchPattern":"try {\n  const col = parseSwagger2Collection(spec);\n} catch (err) {\n  const real = err instanceof Error ? err : new Error(String(err));\n  // surface real.message instead of the generic 'Unknown error'\n  throw real;\n}","preventionTips":["Never throw non-Error values from your own helpers — always `throw new Error(...)`.","If calling third-party validators, wrap their rejections in Error before rethrowing.","Add a unit test that feeds a non-Error throw to confirm your wrapper normalizes correctly."],"tags":["swagger","openapi","error-normalization","bruno-converters"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}