Package and compendium pack IDs may only be alphanumeric with hyphens or underscores; unable to DEL

Somehow in one of the earlier versions of FoundryV13 I managed to write an invalid flag (has an equal sign). I thought I fixed it with a -=, but it managed to slip thru to one of my system users. Now i can't delete the actor.
// Get a list of invalidActors
const myActors = [];
for (const id of game.actors.invalidDocumentIds) {
// have to remove the offending flag before we can get the item
const myActorSource = game.actors._source.find(a=> a._id=== id);
console.log(myActorSource);

delete myActorSource.flags["hero6efoundryvttv2-=activeMovement"];
myActors.push(game.actors.getInvalid(id));
}
console.warn(myActors);

// Save the fix
for(const actor of myActors) {
await actor.update({ "flags": actor.flags}, {diff:false});
}
// Get a list of invalidActors
const myActors = [];
for (const id of game.actors.invalidDocumentIds) {
// have to remove the offending flag before we can get the item
const myActorSource = game.actors._source.find(a=> a._id=== id);
console.log(myActorSource);

delete myActorSource.flags["hero6efoundryvttv2-=activeMovement"];
myActors.push(game.actors.getInvalid(id));
}
console.warn(myActors);

// Save the fix
for(const actor of myActors) {
await actor.update({ "flags": actor.flags}, {diff:false});
}
I can't update the actor. I can't delete the actor. Nothing seems to work. Any suggestions?
No description
1 Reply
Farling
Farling5d ago
Can you do something in the actor migrateData() function to modify the id before the actor is actually fully created?

Did you find this page helpful?