hoppscotch/hoppscotch · error · Error

pm.execution.setNextRequest() is not supported in Hoppscotch

Error message

pm.execution.setNextRequest() is not supported in Hoppscotch (Collection Runner feature)

What it means

`pm.execution.setNextRequest()` is a Postman Collection Runner control-flow method (override the next request to run). Hoppscotch does not support runner-driven flow control, so the stub at pre-request.js:1614 throws whenever invoked. Note `pm.execution.location` IS supported (it returns `["Hoppscotch"]`), but the flow-control methods are not.

Source

Thrown at packages/hoppscotch-js-sandbox/src/bootstrap-code/pre-request.js:1615

          "pm.iterationData.toJSON() is not supported in Hoppscotch (Collection Runner feature)"
        )
      },
    },

    // Execution control (unsupported)
    execution: {
      location: (() => {
        const location = ["Hoppscotch"]
        Object.defineProperty(location, "current", {
          value: "Hoppscotch",
          writable: false,
          enumerable: true,
        })
        Object.freeze(location)
        return location
      })(),
      setNextRequest: () => {
        throw new Error(
          "pm.execution.setNextRequest() is not supported in Hoppscotch (Collection Runner feature)"
        )
      },
      skipRequest: () => {
        throw new Error(
          "pm.execution.skipRequest() is not supported in Hoppscotch (Collection Runner feature)"
        )
      },
      runRequest: () => {
        throw new Error(
          "pm.execution.runRequest() is not supported in Hoppscotch (Collection Runner feature)"
        )
      },
    },

    // Package imports (unsupported)
    require: (packageName) => {
      throw new Error(

View on GitHub (pinned to 1acb8a3a75)

Solutions

  1. Remove the `setNextRequest(...)` call; Hoppscotch runs requests in the order defined by the client/runner, not the script.
  2. Implement request ordering and early-exit logic in the external runner or UI driving Hoppscotch, not inside the sandbox script.
  3. Use `pm.execution.location.current` (which IS supported) only to detect you are running under Hoppscotch, not to control flow.

Example fix

// before
if (skip) { pm.execution.setNextRequest(null) }
else { pm.execution.setNextRequest("GetUser") }
// after - flow control must live outside the script
// (handle skip/order in the runner or UI; the script cannot reorder requests)
Defensive patterns

Strategy: validation

Validate before calling

const UNSUPPORTED = /pm\.execution\.setNextRequest\s*\(/
function assertNoFlowControl(src) {
  if (UNSUPPORTED.test(src)) throw new Error("pm.execution.setNextRequest() is unsupported in Hoppscotch")
}

Try / catch

try { /* run script */ }
catch (e) {
  if (/execution\.setNextRequest\(\) is not supported/.test(e?.message)) {
    /* move ordering logic to the runner */
  } else throw e
}

Prevention

When it happens

Trigger: Calling `pm.execution.setNextRequest("RequestName")` or `pm.execution.setNextRequest(null)` in a script to reorder or stop a collection run.

Common situations: Postman collections that branch request order conditionally, or use `setNextRequest(null)` to terminate a run early. Scripts migrated from Postman that orchestrate flow.

Related errors


AI-assisted analysis of hoppscotch/hoppscotch@1acb8a3a75 (2026-08-12). Data as JSON: /api/errors/f960569955d6a87d. Report an issue: GitHub.