Shopify / Shopify/hydrogen

MiniOxygen dev: `Cannot perform I/O on behalf of a different request (SpanParent)`

Open
#3,789 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.1k
Forks
443
Avg merge
4d 19h
Merged PRs (30d)
24

Description

What is the location of your example repository?

No response

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

@shopify/cli 3.92.x; @shopify/hydrogen 2026.1.1; @shopify/mini-oxygen 4.0.1 (after updating the packages, the errors were still happening)

What version of React Router 7 are you using?

7.12.0

Steps to Reproduce

Unfortunalely, I do not have an isolated reproduction to share. The errors surface reliably in our production storefront codebase but I was not able to extract a minimal Hydrogen skeleton that triggers them in the same way.

Expected Behavior

Dev server running without unexpected errors or getting stuck

Actual Behavior

The dev server logs multiple distinct stack traces of Cannot perform I/O on behalf of a different request (I/O type: SpanParent) and [Error: Promise will never complete.], often followed by [Error: The script will never generate a response.]. Most requests still return 200, but a noticeable percentage hang.

Sample 1:

Error: Cannot perform I/O on behalf of a different request. I/O objects (such as streams,
request/response bodies, and others) created in the context of one request handler cannot
be accessed from a different request's handler. (I/O type: SpanParent)
  at Object.invoke (@shopify/mini-oxygen/dist/vite/worker-entry.js:1382:22)
  at Object.invoke (@shopify/mini-oxygen/dist/vite/worker-entry.js:584:40)
  at Object.invoke (@shopify/mini-oxygen/dist/vite/worker-entry.js:707:34)
  at ModuleRunner.getModuleInformation (@shopify/mini-oxygen/dist/vite/worker-entry.js:1202:94)
  at ModuleRunner.cachedModule (@shopify/mini-oxygen/dist/vite/worker-entry.js:1188:21)
  at request (@shopify/mini-oxygen/dist/vite/worker-entry.js:1224:99)
  at /apps/storefront/app/root.tsx:1:1
  at Object.runInlinedModule (@shopify/mini-oxygen/dist/vite/worker-entry.js:1418:11)
  at ModuleRunner.directRequest (@shopify/mini-oxygen/dist/vite/worker-entry.js:1281:61)
  at ModuleRunner.cachedRequest (@shopify/mini-oxygen/dist/vite/worker-entry.js:1177:79)

Sample 2:

Volume discounts API error: Error: Cannot perform I/O on behalf of a different request.
(I/O type: SpanParent)
  at Object.getItem [as get] (@shopify/hydrogen/dist/.../runWithCache:4345:32)
  at getItemFromCache (@shopify/hydrogen/dist/.../runWithCache:4409:35)
  at runWithCache (@shopify/hydrogen/dist/.../runWithCache:4518:28)
  at Object.run (@shopify/hydrogen/dist/.../runWithCache:4663:14)
  at action (app/routes/($locale).api.volume-discounts.tsx:32:26)
  ...

Sample 3:

Error: Cannot perform I/O on behalf of a different request. (I/O type: SpanParent)
  at Object.forward (@shopify/hydrogen/dist/.../forward:5280:37)
  at @shopify/hydrogen/dist/oxygen/index.js:75:44
  ...

Often accompanied by:

[Error: Promise will never complete.]
[Error: The script will never generate a response.]
A hanging Promise was canceled.

Same code paths execute cleanly in production Oxygen (no errors) and via shopify hydrogen preview --build ).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failing development request in app/root.tsx and the volume-discounts action at app/routes/($locale).api.volume-discounts.tsx:32, then compare its behavior with shopify hydrogen preview --build, where the paths work cleanly. Trace the reported calls through MiniOxygen's worker-entry.js and Hydrogen's runWithCache and forward paths. Done means the development server handles these requests without cross-request I/O errors or hanging promises.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.