usebruno/bruno · error · Error

${result.error}

Error message

${result.error}

What it means

Thrown by scriptTranslationWorker (the <=50 scripts path) when the worker pool's runTask resolves with a result object carrying an `error` field. The worker script (translate-postman-scripts.js) returns { error } instead of throwing when it catches an internal failure, so this throw converts that sentinel into a real exception. The original error text is the value of result.error.

Source

Thrown at packages/bruno-converters/src/workers/postman-translator-worker.js:160

}

const scriptTranslationWorker = async (scriptMap) => {
  // Convert the Map to an array of entries
  const scriptEntries = Array.from(scriptMap.entries());
  const maxWorkers = getMaxWorkers();

  // For very small collections, don't parallelize
  if (scriptEntries.length <= 50) {
    const workerPool = new WorkerPool(path.join(__dirname, './src/workers/scripts/translate-postman-scripts.js'), 1);
    workerPool.initialize();

    try {
      const translatedScripts = new Map();
      const result = await workerPool.runTask({ scripts: scriptEntries });

      if (result.error) {
        console.error('Error in script translation worker:', result.error);
        throw new Error(result.error);
      }

      result.forEach(([uid, { request }]) => {
        translatedScripts.set(uid, { request });
      });

      return translatedScripts;
    } finally {
      workerPool.terminate();
    }
  }

  const workerCount = Math.min(maxWorkers, 4);

  // Create balanced batches based on script complexity
  const batches = createBalancedBatches(scriptEntries, workerCount);

  const translatedScripts = new Map();

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Inspect stderr — `console.error('Error in script translation worker:', result.error)` on line 159 prints the worker's error detail.
  2. Import with `{ preserveScripts: true }` to skip translation entirely and keep raw scripts.
  3. Simplify or fix the offending Postman script, then re-import.

Example fix

// before
const translated = await scriptTranslationWorker(map);

// after — skip translation on failure
try {
  return await scriptTranslationWorker(map);
} catch (e) {
  console.warn('script translation failed, falling back', e.message);
  return map; // return un-translated entries
}
Defensive patterns

Strategy: fallback

Validate before calling

const hasTranslatableScripts = (map) => {
  for (const [, entry] of map) {
    if (entry?.request?.tests || entry?.request?.preRequest) return true;
  }
  return false;
};

Try / catch

try {
  return await scriptTranslationWorker(map);
} catch (e) {
  console.warn('script translation failed, keeping originals:', e.message);
  return map; // fallback: return un-translated entries
}

Prevention

When it happens

Trigger: A Postman pre-request or test script that the translate-postman-scripts worker cannot parse/translate, causing the worker to populate result.error. Triggers only when the collection has <=50 script entries (the small-collection path).

Common situations: Scripts using Postman sandbox APIs the translator does not support (pm.sendRequest callbacks, complex pm.expect chains, syntax errors in the script, unsupported pm.require targets).

Related errors


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