Character Sheet cannot be opened.

Issue #103 resolved
Former user created an issue

I get the following error when trying to open/duplicate it. It happened during dropping items into the inventory. Neither the player or myself are able to open it.

Uncaught (in promise) TypeError: Converting circular structure to JSON --> starting at object with constructor 'Object' | property 'flags' -> object with constructor 'Object' | property 'obsidian' -> object with constructor 'Object' | property 'contents' -> object with constructor 'Array' --- index 0 closes the circle at JSON.stringify (<anonymous>) at duplicate (foundry.js:760) at Obsidian.getData (base.js:60) at Obsidian.getData (character.js:41) at Obsidian.getData (obsidian.js:173) at Obsidian._render (foundry.js:3824) at Obsidian._render (foundry.js:4434) at Obsidian._render (foundry.js:17199) at Obsidian._render (obsidian.js:360) at Obsidian.render (foundry.js:3798)

Comments (4)

  1. Kim Mantas repo owner

    Yeah I’ve seen this happen a few times where a character somehow manages to put a backpack inside itself. I still don’t know why it happens but you can try to fix it by pasting this code snippet into the console and hitting Enter:

    (function () {
        const actor = game.actors.getName('CHARACTER NAME HERE');
        const updates = [];
        actor.data.items.forEach(i => {
            if (i.flags.obsidian.order?.length || i.flags.obsidian.parent) {
                const update = {_id: i._id};
                updates.push(update);
                if (i.flags.obsidian.order?.length) {
                    update['flags.obsidian.order'] = [];
                }
    
                if (i.flags.obsidian.parent) {
                    update['flags.obsidian.-=parent'] = null;
                }
            }
        });
    
        actor.updateEmbeddedEntity('OwnedItem', updates);
    })();
    

    Replace the CHARACTER NAME HERE with the problematic character’s name, but make sure it’s still surrounded by the quotation marks.

    If you have any clues as to how the character ended up in this state it might help me prevent the issue in future.

  2. Perry Mike

    That fixed it. It happened when the player and I were both editing his character sheet. He was adding Hempen Rope to his sheet while I added a bag of holding when I then deleted as it was meant for another character.

  3. Perry Mike

    Got this today when I was helping a player edit his class features. Seems to be somewhat repeatable. The fix you posted above doesn’t help.

    edit: Updated Obsidian and it fixed.

  4. Log in to comment