Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pack generates error when doc contains "effects" #41

Open
toastygm opened this issue Oct 11, 2023 · 0 comments
Open

pack generates error when doc contains "effects" #41

toastygm opened this issue Oct 11, 2023 · 0 comments

Comments

@toastygm
Copy link

toastygm commented Oct 11, 2023

When attempting to perform a pack operation on a document that includes active effects, the pack operation aborts with an error. See sample here:

$ fvtt package pack hmk-possessions -v --type System --id hmk -t Item --in ~/dev/github/HarnMaster-Kethira-FoundryVTT/packs/hmk-possessions/_source --out /tmp/stage-hmk/packs/
[classic-level] Packing "/Users/tomr/dev/github/HarnMaster-Kethira-FoundryVTT/packs/hmk-possessions/_source" into "/tmp/stage-hmk/packs/hmk-possessions"
Packed M4nHcUWOatfVGuh3 (Armor)
Packed 3V8dQgPspKX32aUw (Armor Traits)
Failed to parse /Users/tomr/dev/github/HarnMaster-Kethira-FoundryVTT/packs/hmk-possessions/_source/arrow__heavy_bodkin_P3LMGDmP8tYLEbAb.json. See error below.
ModuleError: Key cannot be null or undefined
    at ClassicLevel._checkKey (/Users/tomr/dev/github/foundryvtt-cli/node_modules/abstract-level/abstract-level.js:780:14)
    at DefaultChainedBatch.put (/Users/tomr/dev/github/foundryvtt-cli/node_modules/abstract-level/abstract-chained-batch.js:41:25)
    at file:///Users/tomr/dev/github/foundryvtt-cli/lib/package.mjs:243:11
    at async apply (file:///Users/tomr/dev/github/foundryvtt-cli/lib/package.mjs:410:24)
    at async apply (file:///Users/tomr/dev/github/foundryvtt-cli/lib/package.mjs:414:52)
    at async compileClassicLevel (file:///Users/tomr/dev/github/foundryvtt-cli/lib/package.mjs:253:7)
    at async handlePack (file:///Users/tomr/dev/github/foundryvtt-cli/commands/package.mjs:418:5)
    at async Object.handler (file:///Users/tomr/dev/github/foundryvtt-cli/commands/package.mjs:124:22) {
  code: 'LEVEL_INVALID_KEY'

The offending document is attached here:
arrow__heavy_bodkin_P3LMGDmP8tYLEbAb.json

The problem seems to be in foundryvtt-cli/lib/package.mjs line 414, where it is going through each item in the effects array. It is recursively calling the apply function, but that assumes the first entry is a document. In fact, in the case of an effect, that first entry is a string, not an object. So, it subsequently fails when trying to find the "_key" element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant