pf2e icon indicating copy to clipboard operation
pf2e copied to clipboard

Several old items not migrating properly

Open zarmstrong opened this issue 2 years ago • 1 comments

Here's an example item:

{
    "_id": "i6ASm3Xcmofsyb8z",
    "data": {
      "description": {
        "value": "",
        "chat": "",
        "unidentified": ""
      },
      "source": {
        "value": ""
      },
      "traits": {
        "value": [],
        "rarity": {
          "value": "common"
        },
        "custom": "",
        "usage": {
          "value": "held-in-one-hand"
        }
      },
      "rules": [],
      "slug": "rations",
      "schema": {
        "version": 0.649,
        "lastMigration": null
      },
      "quantity": {
        "value": 1
      },
      "baseItem": null,
      "hp": {
        "value": 0
      },
      "maxHp": {
        "value": 0
      },
      "hardness": {
        "value": 0
      },
      "brokenThreshold": {
        "value": 0
      },
      "weight": {
        "value": "L"
      },
      "equippedBulk": {
        "value": ""
      },
      "price": {
        "value": "4 sp"
      },
      "equipped": {
        "value": false
      },
      "stackGroup": {
        "value": "rations"
      },
      "bulkCapacity": {
        "value": ""
      },
      "negateBulk": {
        "value": "0"
      },
      "containerId": {
        "value": ""
      },
      "preciousMaterial": {
        "value": ""
      },
      "preciousMaterialGrade": {
        "value": "standard"
      },
      "collapsed": {
        "value": false
      },
      "size": {
        "value": "med"
      },
      "identification": {
        "status": "identified",
        "unidentified": {
          "name": "",
          "img": "",
          "data": {
            "description": {
              "value": ""
            }
          }
        },
        "misidentified": []
      },
      "level": {
        "value": 0
      },
      "invested": {
        "value": false
      },
      "usage": {
        "value": "held-in-one-hand"
      }
    },
    "effects": [],
    "flags": {
      "core": {
        "sourceId": "Compendium.pf2e.equipment-srd.L9ZV076913otGtiB"
      }
    },
    "img": "systems/pf2e/icons/equipment/adventuring-gear/rations.webp",
    "name": "Rations",
    "type": "equipment",
    "folder": null,
    "sort": 0,
    "permission": {
      "default": 0
    }
  }

Add that to a fresh character's JSON export and reimport. You will get the following error several times:

foundry.js:747 TypeError: Failed data preparation for Actor..Item.i6ASm3Xcmofsyb8z. str.replace is not a function
    at sluggify (main.bundle.js:19:788146)
    at EquipmentPF2e.prepareBaseData (main.bundle.js:1:708947)
    at EquipmentPF2e.prepareBaseData (main.bundle.js:1:672467)
    at EquipmentPF2e.prepareData (foundry.js:13172:10)
    at EquipmentPF2e.prepareData (main.bundle.js:1:626523)
    at EquipmentPF2e._safePrepareData (foundry.js:13152:12)
    at CharacterPF2e.prepareEmbeddedDocuments (foundry.js:13195:11)
    at CharacterPF2e.prepareEmbeddedDocuments (foundry.js:16430:11)
    at CharacterPF2e.prepareEmbeddedDocuments (main.bundle.js:1:29630)
    at CharacterPF2e.prepareEmbeddedDocuments (main.bundle.js:1:176760)
onError @ foundry.js:747
_safePrepareData @ foundry.js:13154
prepareEmbeddedDocuments @ foundry.js:13195
prepareEmbeddedDocuments @ foundry.js:16430
prepareEmbeddedDocuments @ main.bundle.js:1
prepareEmbeddedDocuments @ main.bundle.js:1
prepareEmbeddedDocuments @ main.bundle.js:1
prepareData @ foundry.js:13173
prepareData @ main.bundle.js:1
prepareData @ main.bundle.js:1
_safePrepareData @ foundry.js:13152
_initialize @ foundry.js:12977
_initialize @ main.bundle.js:1
DataModel @ commons.js:5240
Document @ commons.js:5778
BaseActor @ commons.js:7128
ClientDocumentMixin @ foundry.js:12941
Actor @ foundry.js:16162
ActorPF2e @ main.bundle.js:1
CreaturePF2e @ main.bundle.js:1
CharacterPF2e @ main.bundle.js:1
ActorPF2e @ main.bundle.js:1
CreaturePF2e @ main.bundle.js:1
CharacterPF2e @ main.bundle.js:1
exports.preImportJSON @ main.bundle.js:1
importFromJSON @ main.bundle.js:1
(anonymous) @ foundry.js:13695
Promise.then (async)
callback @ foundry.js:13695
submit @ foundry.js:55745
_onClickButton @ foundry.js:55674
dispatch @ jquery.min.js:2
y.handle @ jquery.min.js:2

Foundry v10.286 pf2e 4.1.2

zarmstrong avatar Sep 22 '22 21:09 zarmstrong

I can provide other items if you want, but they all throw the exact same error.

zarmstrong avatar Sep 22 '22 21:09 zarmstrong

I don't think I'm qualified to give advice on how to resolve, but for anyone looking into this, 728-flatten-physical-properties.ts probably didn't get this item in question.

As of 4.2.2 you shouldn't see this error anymore even with your data; it'll be a warning. Still doesn't address your root cause problem that the data isn't migrated.

KSops avatar Nov 10 '22 01:11 KSops