#34949·cypress

cy.task() must only be invoked from the spec file or support file — regression in 16.0.0/16.1.0

Author: Jack-Booth-DotmaticsCreated Sep 29, 2026Updated Sep 29, 2026

Current behavior

Reference: the prior incarnations — #30933 (v14), #27099 (v12.15)

Reproduction: cy.task() called inside a .then() chain (e.g. cy.wait('@alias').then(() => cy.task('foo'))) — the Bluebird stack trace has no spec-file frames

Desired behavior

Image This error is no longer present during test runs.

Test code to reproduce

Reproduction: cy.task() called inside a .then() chain (e.g. cy.wait('@alias').then(() => cy.task('foo'))) — the Bluebird stack trace has no spec-file frames

Cypress Version

16.0.0 and 16.1.0

Debug Logs

bash

Other

No response