pentaho/pentaho-kettle · error · TypeError

You must pass a resolver function as the first argument to…

Error message

You must pass a resolver function as the first argument to the promise constructor

What it means

The bundled es6-promise polyfill's Promise constructor requires its first argument to be a function (the resolver). If `new Promise(x)` is called with a non-function or no argument, needsResolver() throws this TypeError. This mirrors the native ES6 Promise specification.

Solutions

  1. Pass an executor function: new Promise(function(resolve, reject) { ... }).
  2. If you already have a value, use Promise.resolve(value) instead of the constructor.
  3. If you already have a failure, use Promise.reject(reason).

Example fix

// before
var p = new Promise(doWork());
// after
var p = new Promise(function(resolve, reject) { doWork(resolve, reject); });
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof executor !== 'function') { return Promise.resolve(value); }

Type guard

function isExecutor(x) { return typeof x === 'function' && x.length === 2; }

Try / catch

try { p = new Promise(executor); } catch (e) { if (e instanceof TypeError && /resolver/.test(e.message)) { p = Promise.resolve(value); } else throw e; }

Prevention

When it happens

Trigger: new Promise() with no argument; new Promise('value') or new Promise(someObject) where a non-function was passed (e.g. a thenable instead of an executor).

Common situations: Wrapping callback APIs and accidentally passing the callback result rather than a function; copying code where the executor was refactored away; calling a promise factory that forwards arguments to Promise directly.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/b6462984907fcb1f. Report an issue: GitHub.

Appendix: source

Thrown at plugins/core-ui/src/main/resources/app/pentaho/shim/_es6-promise/es6-promise.js:531

      var promise = new Constructor(lib$es6$promise$$internal$$noop);
      lib$es6$promise$$internal$$resolve(promise, object);
      return promise;
    }
    var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;
    function lib$es6$promise$promise$reject$$reject(reason) {
      /*jshint validthis:true */
      var Constructor = this;
      var promise = new Constructor(lib$es6$promise$$internal$$noop);
      lib$es6$promise$$internal$$reject(promise, reason);
      return promise;
    }
    var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;

    var lib$es6$promise$promise$$counter = 0;

    function lib$es6$promise$promise$$needsResolver() {
      throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
    }

    function lib$es6$promise$promise$$needsNew() {
      throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
    }

    var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;
    /**
      Promise objects represent the eventual result of an asynchronous operation. The
      primary way of interacting with a promise is through its `then` method, which
      registers callbacks to receive either a promise’s eventual value or the reason
      why the promise cannot be fulfilled.

      Terminology
      -----------

      - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
      - `thenable` is an object or function that defines a `then` method.

View on GitHub (pinned to f3058517a1)