parcel icon indicating copy to clipboard operation
parcel copied to clipboard

`Error: Expected content key 0788422aa91f880f to exist` when renaming `.tsx` -> `.ts`

Open danieltroger opened this issue 3 years ago • 7 comments

🐛 bug report

parcel serve crashes when renaming a file from .ts to .tsx to .ts

✨ Built in 154ms
Error: Expected content key 0788422aa91f880f to exist
    at nullthrows (/private/tmp/parcel-weird-transformations/node_modules/nullthrows/nullthrows.js:7:15)
    at ContentGraph.getNodeIdByContentKey (/private/tmp/parcel-weird-transformations/node_modules/@parcel/core/lib/ContentGraph.js:90:38)
    at BundleGraph.getDependencies (/private/tmp/parcel-weird-transformations/node_modules/@parcel/core/lib/BundleGraph.js:588:30)
    at BundleGraph.getDependencies (/private/tmp/parcel-weird-transformations/node_modules/@parcel/core/lib/public/BundleGraph.js:198:48)
    at /private/tmp/parcel-weird-transformations/node_modules/@parcel/reporter-dev-server/lib/HMRServer.js:108:46
    at /private/tmp/parcel-weird-transformations/node_modules/@parcel/utils/lib/PromiseQueue.js:55:30
    at PromiseQueue._runFn (/private/tmp/parcel-weird-transformations/node_modules/@parcel/utils/lib/PromiseQueue.js:108:13)
    at PromiseQueue._next (/private/tmp/parcel-weird-transformations/node_modules/@parcel/utils/lib/PromiseQueue.js:95:16)
    at PromiseQueue.run (/private/tmp/parcel-weird-transformations/node_modules/@parcel/utils/lib/PromiseQueue.js:86:12)
    at HMRServer.emitUpdate (/private/tmp/parcel-weird-transformations/node_modules/@parcel/reporter-dev-server/lib/HMRServer.js:135:30) {
  framesToPop: 1
}
Error: Expected content key 0788422aa91f880f to exist
    at nullthrows (/private/tmp/parcel-weird-transformations/node_modules/nullthrows/nullthrows.js:7:15)
    at ContentGraph.getNodeIdByContentKey (/private/tmp/parcel-weird-transformations/node_modules/@parcel/core/lib/ContentGraph.js:90:38)
    at BundleGraph.getDependencies (/private/tmp/parcel-weird-transformations/node_modules/@parcel/core/lib/BundleGraph.js:588:30)
    at BundleGraph.getDependencies (/private/tmp/parcel-weird-transformations/node_modules/@parcel/core/lib/public/BundleGraph.js:198:48)
    at /private/tmp/parcel-weird-transformations/node_modules/@parcel/reporter-dev-server/lib/HMRServer.js:108:46
    at /private/tmp/parcel-weird-transformations/node_modules/@parcel/utils/lib/PromiseQueue.js:55:30
    at PromiseQueue._runFn (/private/tmp/parcel-weird-transformations/node_modules/@parcel/utils/lib/PromiseQueue.js:108:13)
    at PromiseQueue._next (/private/tmp/parcel-weird-transformations/node_modules/@parcel/utils/lib/PromiseQueue.js:95:16)
    at PromiseQueue.run (/private/tmp/parcel-weird-transformations/node_modules/@parcel/utils/lib/PromiseQueue.js:86:12)
    at HMRServer.emitUpdate (/private/tmp/parcel-weird-transformations/node_modules/@parcel/reporter-dev-server/lib/HMRServer.js:135:30) {
  framesToPop: 1
}
error Command failed with exit code 1.

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

Please see attached .zip

🤔 Expected Behavior

No crash

😯 Current Behavior

Crash

💁 Possible Solution

Fix crash

🔦 Context

Was renaming a file because I wanted to use jsx in it but then I chickened out.

💻 Code Sample

Download this: parcel-rename-crash.zip

  1. Unzip
  2. yarn install
  3. yarn serve
  4. In other terminal window: cd src
  5. mv stuff.ts stuff.tsx
  6. mv stuff.tsx stuff.ts
  7. Switch back to other terminal window and observe that parcel has crashed

🌍 Your Environment

Software Version(s)
Parcel 2.0.0-nightly.746+d1e0a1a0
Node v16.4.0
npm/Yarn yarn 1.22.10
Operating System macOS 10.15.7 (19H1217)

danieltroger avatar Jun 29 '21 16:06 danieltroger