usebruno/bruno · error · Error

${err}

Error message

${err}

What it means

Thrown by the batched (>50 scripts) path of scriptTranslationWorker when a worker pool task rejects. The catch wraps the rejection in `new Error(err)`, where err may itself be an Error or a plain value — `new Error(err)` coerces it to a string message. This path differs from error 127: it uses Promise.allSettled over parallel batches, so one failing batch fails the whole translation.

Source

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

  const batches = createBalancedBatches(scriptEntries, workerCount);

  const translatedScripts = new Map();

  // Create worker pool with optimal size
  const workerPool = new WorkerPool(path.join(__dirname, './src/workers/scripts/translate-postman-scripts.js'), workerCount);
  workerPool.initialize();

  // Process all batches in parallel using worker pool
  const batchPromises = batches.map((batch) => {
    return workerPool.runTask({ scripts: batch })
      .then((modScripts) => {
        modScripts.forEach(([name, { request }]) => {
          translatedScripts.set(name, { request });
        });
      })
      .catch((err) => {
        console.error('Error in script translation worker:', err);
        throw new Error(err);
      });
  });

  // Wait for all batches to complete
  try {
    await Promise.allSettled(batchPromises);
  } finally {
    // Clean up worker pool
    workerPool.terminate();
  }

  return translatedScripts;
};

export default scriptTranslationWorker;

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Read stderr from line 193 (`console.error('Error in script translation worker:', err)`) to find which batch/script failed.
  2. Note that Promise.allSettled is used but the catch rethrows — a single batch failure aborts all; consider importing with preserveScripts to bypass.
  3. Reduce collection size or split imports to locate the offending script.

Example fix

// before (worker catch)
.catch((err) => {
  console.error('worker err', err);
  throw new Error(err);
});

// after — preserve Error chain
.catch((err) => {
  console.error('worker err', err);
  throw err instanceof Error ? err : new Error(String(err));
});
Defensive patterns

Strategy: try-catch

Try / catch

try {
  return await scriptTranslationWorker(map);
} catch (e) {
  throw e instanceof Error ? e : new Error(String(e));
}

Prevention

When it happens

Trigger: Any worker.runTask rejection during parallel batch translation of Postman scripts (collections with >50 script entries). The same root causes as error 127, but on the large-collection code path.

Common situations: Large Postman collections where one script among many is untranslatable; worker thread crash/OOM; the translate-postman-scripts worker throwing on a specific pm.* API.

Related errors


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