parcel: parcel watch error: Expected content key 2d39cdf7c618ab5b to exist

🐛 bug report

When running parcel watch 'packages/*' --no-cache I’m getting the following errors:

Error: Expected content key 2d39cdf7c618ab5b to exist
    at nullthrows (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/nullthrows/nullthrows.js:7:15)
    at ContentGraph.getNodeIdByContentKey (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/graph/lib/ContentGraph.js:81:38)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/BundleGraph.js:746:30)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/public/BundleGraph.js:145:24)
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17188:54
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33551:34
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._runFn (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33579:19)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._next (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33572:20)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039.run (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33567:81)
    at $7728b866c345490a$export$2e2bcd8739ae039.emitUpdate (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17210:34) {
  framesToPop: 1
}
Error: Expected content key 2d39cdf7c618ab5b to exist
    at nullthrows (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/nullthrows/nullthrows.js:7:15)
    at ContentGraph.getNodeIdByContentKey (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/graph/lib/ContentGraph.js:81:38)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/BundleGraph.js:746:30)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/public/BundleGraph.js:145:24)
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17188:54
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33551:34
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._runFn (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33579:19)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._next (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33572:20)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039.run (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33567:81)
    at $7728b866c345490a$export$2e2bcd8739ae039.emitUpdate (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17210:34) {
  framesToPop: 1
}
Error: Expected content key 2b62a9a42f419169 to exist
    at nullthrows (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/nullthrows/nullthrows.js:7:15)
    at ContentGraph.getNodeIdByContentKey (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/graph/lib/ContentGraph.js:81:38)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/BundleGraph.js:746:30)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/public/BundleGraph.js:145:24)
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17188:54
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33551:34
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._runFn (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33579:19)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._next (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33572:20)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039.run (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33567:81)
    at $7728b866c345490a$export$2e2bcd8739ae039.emitUpdate (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17210:34) {
  framesToPop: 1
}
Error: Expected content key a628082bff6583f1 to exist
    at nullthrows (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/nullthrows/nullthrows.js:7:15)
    at ContentGraph.getNodeIdByContentKey (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/graph/lib/ContentGraph.js:81:38)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/BundleGraph.js:746:30)
    at BundleGraph.getDependencies (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/core/lib/public/BundleGraph.js:145:24)
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17188:54
    at /Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33551:34
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._runFn (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33579:19)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._next (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33572:20)
    at $b0fd219fea43bcac$export$2e2bcd8739ae039._next (/Users/tedpalmer/Desktop/reservoir-kit/node_modules/@parcel/utils/lib/index.js:33573:38)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  framesToPop: 1
✨ Built in 6.89s

Running parcel build 'packages/*' --no-cache builds fine with no errors.

Downgrading to parcel 2.8.2 didn’t fix this, as suggested in #8787

Deleting .parcel-cache also didn’t work.

🎛 Configuration (.babelrc, package.json, cli command)

{
  "devDependencies": {
    "@parcel/optimizer-data-url": "2.8.2",
    "@parcel/packager-ts": "2.8.2",
    "@parcel/transformer-inline-string": "2.8.2",
    "@parcel/transformer-typescript-tsc": "2.8.2",
    "@parcel/transformer-typescript-types": "2.8.2",
    "@types/node": "^17.0.10",
    "@types/react": "^18.0.15",
    "@types/react-dom": "^18.0.6",
    "buffer": "^6.0.3",
    "ethers": "^5.6.9",
    "gitlog": "^4.0.4",
    "parcel": "2.8.2",
    "prettier": "^2.5.1",
    "process": "^0.11.10",
    "replace-in-files": "^3.0.0",
    "typescript": "^4.9.4"
  },
}

🤔 Expected Behavior

Running parcel watch 'packages/*' --no-cache should build with no errors, just as parcel build 'packages/*' --no-cache does.

😯 Current Behavior

Seeing the errors mentioned above.

💁 Possible Solution

Update: adding the --no-hmr parameter to parcel watch made the errors go away

🔦 Context

💻 Code Sample

Here is the repo where I am running into this issue: https://github.com/reservoirprotocol/reservoir-kit/tree/ted/upgrade-typescript-solution

🌍 Your Environment

Software Version(s)
Parcel 2.8.3 and 2.8.2
Node
npm/Yarn
Operating System macOS Ventura 13.1

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 8
  • Comments: 31

Most upvoted comments

For me it worked when I deleted the .parcel-cache and dist folders completely in the root directory and did the rebuild.

delete the .parcel-cache folder, then try running command again, it’ll work.

Same error occurred to me in parcel version - 2.9.3 Solution that worked for me - clear the parcel cache (rm -rf .parcel-cache) and run the application again.

delete the .parcel-cache folder, then try running command again, it’ll work.

This fixed it for me.

delete the .parcel-cache folder, then try running command again, it’ll work.

This worked for me

I’m also experiencing this issue, but it’s also on my build. At first I noticed it when building my Docker image but not locally. After clearing my package-lock and installing the latest version it began happening locally as well.

I’ve also tried 2.8.2 and same result.

When I tried to revert back to the version I was using, 2.7.0, I started getting a new error:

@parcel/workers: Expected constructor 2.7.0:BundleGraph to be registered with serializer to deserialize

I’ve yet to find a way around this issue.

EDIT:

Just now found a way around it. I reverted to 2.7.0 again and found where the error in reverting before was. I hadn’t explicitly installed @parcel/core at 2.7.0. Adding that to the dependencies, matching parcel and @parcel/transformer-sass my build functions again.

error: Expected content key de1e4a02ec63c4eb to exist This error occurs in parcel version 2.9.2 . then I downgrade the parcel version into 2.7.0 and then error resolved .

I just deleted the .parcel-cache and dist folders completely from the root directory and rebuild the applicate, it did worked for me

Update: I also hadn’t explicitly installed @parcel/core, however, that didn’t fix the issue for me. After a lot of testing I discovered that adding the --no-hmr parameter to parcel watch made the errors go away

Step 1. Stop the Server (ctrl + c) Step 2. Delete .parcel-cache folder Step 3. npx parcel index.html

Problem solved!🤝

delete the .parcel-cache folder, then try running command again, it’ll work.

This worked for me too. Thank you

delete the .parcel-cache folder, then try running command again, it’ll work.

its working✨

Thanks, I deleted both the dist and cache, and now it works. It accidentally deleted the dist first so you probably won’t have to. But thanks for the solution. I haven’t worked with a dist before so appreciate your post.

then

this worked for me