{"record":{"id":"9dc69b8599e154cb","repo":"usebruno/bruno","slug":"invalid-postman-collection-format-please-check-yo","errorCode":null,"errorMessage":"Invalid Postman collection format. Please check your JSON file.","messagePattern":"Invalid Postman collection format\\. Please check your JSON file\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-converters/src/postman/postman-to-bruno.js","lineNumber":1185,"sourceCode":"    let v2Schemas = [\n      'https://schema.getpostman.com/json/collection/v2.0.0/collection.json',\n      'https://schema.getpostman.com/json/collection/v2.1.0/collection.json',\n      'https://schema.postman.com/json/collection/v2.0.0/collection.json',\n      'https://schema.postman.com/json/collection/v2.1.0/collection.json'\n    ];\n\n    if (v2Schemas.includes(schema)) {\n      return await importPostmanV2Collection(parsedCollection, { useWorkers, preserveScripts });\n    }\n\n    throw new Error('Unsupported Postman schema version. Only Postman Collection v2.0 and v2.1 are supported.');\n  } catch (err) {\n    console.log(err);\n    if (err instanceof Error) {\n      throw err;\n    }\n\n    throw new Error('Invalid Postman collection format. Please check your JSON file.');\n  }\n};\n\nconst postmanToBruno = async (postmanCollection, { useWorkers = false, preserveScripts = false } = {}) => {\n  try {\n    // Resolve the actual collection envelope (Postman wraps newer exports\n    // in a `{ collection: {...} }` shell) so the raw scan sees real events.\n    const rawCollectionForScan = postmanCollection?.collection?.info\n      ? postmanCollection.collection\n      : postmanCollection;\n    const rawPackages = collectPackagesFromPostmanCollection(rawCollectionForScan);\n\n    const { collection: parsedCollection, issues } = await parsePostmanCollection(postmanCollection, { useWorkers, preserveScripts });\n    const transformedCollection = transformItemsInCollection(parsedCollection);\n    const hydratedCollection = hydrateSeqInCollection(transformedCollection);\n    // Apply backward compatibility transformation for string status to number\n    const statusTransformedCollection = transformExampleStatusInCollection(hydratedCollection);\n    const validatedCollection = validateSchema(statusTransformedCollection);","sourceCodeStart":1167,"sourceCodeEnd":1203,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-converters/src/postman/postman-to-bruno.js#L1167-L1203","documentation":"Thrown by the catch block of parsePostmanCollection when an exception inside the try is NOT an Error instance. This mirrors the error-normalization pattern: genuine Errors (including the 'Unsupported schema' one from error 124) are rethrown as-is, but any non-Error throwable (string, plain object) is converted to a generic 'Invalid Postman collection format' message. It is the defensive fallback for non-Error throwables escaping schema detection/import.","triggerScenarios":"importPostmanV2Collection (or get/collectPackagesFromPostmanCollection) throwing a non-Error value; a JSON-parsed structure causing a library to reject with a plain object; a circular reference producing a non-Error throw.","commonSituations":"Corrupt or truncated Postman JSON that a dependency rejects with a string; collection with circular $ref structures; third-party translator code doing `throw { detail: ... }`.","solutions":["Check stdout — `console.log(err)` on line 1180 prints the original non-Error value.","Validate the JSON is parseable and structurally Postman-v2 before calling the importer.","Patch internal throw sites to use Error instances so the real message reaches the caller."],"exampleFix":"// before (inside importer)\nif (!item.request) throw 'missing request';\n\n// after\nif (!item.request) throw new Error('Postman item is missing a request block: ' + item.name);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const isPlainPostmanCollection = (c) => !!c && typeof c === 'object' && Array.isArray((c.collection?.info ? c.collection : c).item);","tryCatchPattern":"try {\n  return await parsePostmanCollection(coll, opts);\n} catch (e) {\n  // real err is console.logged by the wrapper\n  throw e instanceof Error ? e : new Error(String(e));\n}","preventionTips":["Confirm the JSON is valid and has an `item` array before importing.","Inspect stdout when this fires — the original non-Error value is printed.","Patch internal throw sites to use Error instances for better diagnostics."],"tags":["postman","error-normalization","import","bruno-converters"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}