usebruno/bruno · error · Error

Import collection failed: ${err.message}

Error message

Import collection failed: ${err.message}

What it means

Thrown by the top-level postmanToBruno catch when any stage of the import pipeline fails. Unlike the inner normalizers, this wrapper preserves the original error's message via template literal (`err.message`), so it acts as a context-adding wrapper. Stages that can fail include package scanning, parsePostmanCollection, transformItemsInCollection, hydrateSeqInCollection, transformExampleStatusInCollection, validateSchema, and rewriteRequiresInBrunoCollection.

Source

Thrown at packages/bruno-converters/src/postman/postman-to-bruno.js:1218

    const hydratedCollection = hydrateSeqInCollection(transformedCollection);
    // Apply backward compatibility transformation for string status to number
    const statusTransformedCollection = transformExampleStatusInCollection(hydratedCollection);
    const validatedCollection = validateSchema(statusTransformedCollection);

    // When preserving script option is enabled, skip any rewrite.
    // Otherwise rewrite any pm.require() calls that survived the Bruno-side translator
    // so the imported scripts use plain require(). The post-scan also picks
    // up translator-injected globals (cheerio, tv4, ...) - packages Postman
    // exposed as sandbox globals that the raw pre-scan can't see. The
    // schema is strict + noUnknown so we attach the report by mutating
    // the already-validated collection.
    const injectedPackages = preserveScripts ? [] : rewriteRequiresInBrunoCollection(validatedCollection);
    validatedCollection.packageReport = buildPackageReport([...rawPackages, ...injectedPackages]);

    return { collection: validatedCollection, issues };
  } catch (err) {
    console.log(err);
    throw new Error(`Import collection failed: ${err.message}`);
  }
};

export default postmanToBruno;

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Read the message suffix — the original err.message is appended and `console.log(err)` on line 1217 prints the full object; use it to identify the failing stage.
  2. Retry with `{ preserveScripts: true }` to bypass script translation/rewriting and isolate whether scripts are the cause.
  3. Retry with `{ useWorkers: false }` to run translation in-process for a clearer stack trace.

Example fix

// before
const { collection } = await postmanToBruno(raw);

// after — isolate the failing stage
try {
  const { collection } = await postmanToBruno(raw, { preserveScripts: true, useWorkers: false });
} catch (e) {
  console.error('stage hint:', e.message);
  throw e;
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  return await postmanToBruno(coll, { useWorkers: false, preserveScripts: false });
} catch (e) {
  // isolate: retry with preserveScripts to skip translation
  if (preserveScriptsAvailable) {
    return await postmanToBruno(coll, { preserveScripts: true });
  }
  throw e;
}

Prevention

When it happens

Trigger: Any uncaught error in the import pipeline: schema validation failure of the produced Bruno collection, a script-translation worker error bubbling up, a package-rewrite error, or one of the inner throws (errors 124/125) re-thrown here.

Common situations: Importing a large Postman collection with pre-request/test scripts the translator cannot handle; a collection that translates to a shape Bruno's schema rejects; filesystem/permission issues if scripts touch disk.

Related errors


AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13). Data as JSON: /api/errors/b7414f10f6c1d0ef. Report an issue: GitHub.