Not Found: FlowToken with ID -> how to find which flow/device?

Hi Homey friends,

In my telegram chat I receive a notification once in a while with

Not Found: FlowToken with ID homey:manager:logic:[string with numbers].

How can I find out what flow is broken here?
Besides of course checking all manually…

Gr. Tim

Hi Tim, did you already take a look here: flowchecker

Besides this checking enabled and disabled flows you might use this HomeyScript:

// Function to get and categorize flows
// Author: RuuRd van der Noord
// Date: 2025-01-06

async function getAndCategorizeFlows() {
    try {
        // Fetch standard and advanced flows from Homey
        const [aStandardFlows, aAdvancedFlows] = await Promise.all([
            Homey.flow.getFlows(),
            Homey.flow.getAdvancedFlows()
        ]);

        // Initialize arrays to hold categorized flows
        const aEnabledFlows = [];
        const aDisabledFlows = [];

        // Iterate and categorize flows
        for (const flows of [aStandardFlows, aAdvancedFlows]) {
            for (const flowId in flows) {
                const { enabled, id, name } = flows[flowId];

                if (enabled !== undefined) {
                    (enabled ? aEnabledFlows : aDisabledFlows).push({ id, name, type: flows === aStandardFlows ? 'standard' : 'advanced' });
                } else {
                    console.warn(`Flow with ID ${flowId} is missing or invalid.`);
                }
            }
        }

        // Output the results for enabled flows
        console.log('// Enabled Flows:');
        console.log('const aEnabledFlows = [');
        aEnabledFlows.forEach(({ id, name, type }) => console.log(`{ ID: '${id}', Name: '${name}', Type: '${type}' },`));
        console.log('];');

        // Output the results for disabled flows
        console.log('// Disabled Flows:');
        console.log('const aDisabledFlows = [');
        aDisabledFlows.forEach(({ id, name, type }) => console.log(`{ ID: '${id}', Name: '${name}', Type: '${type}' },`));
        console.log('];');

    } catch (error) {
        // Log any errors that occur during the flow retrieval process
        console.error('An error occurred while retrieving and categorizing flows:', error);
    }
}

// Call the function to execute the flow retrieval and categorization
await getAndCategorizeFlows();

Thanks Ruurd,
Maybe this one is the problem. Is there any way, beside digging my memory/thinking what this tag(?) was?

Well resting with the cursor on this unavailable object/variable will not show anything.
What I do to avoid getting stuck is to create screendumps of every Flow (part).
This does not help you now, but anyway it is a practice that can help you in the future …
Oh yes, when you delete objects/variables/etc. think first … :wink: