@m91t If you can share a screenshot of your flow in edit mode of the Classic Designer (toggle off the New Designer). Ensure you've clicked on each action to expand it.
Initializing a variable in your case is unnecessary and not required. Also, you'll need to add a Filter Array action to your flow to filter out your tasks to see if there are any tasks where the task name is equal to your email subject line. It would be a lot more efficient than looping through each task to check if there is a match.
Also, since you are using the When a new email arrives (V3) trigger, you should consider using trigger conditions in your flow to prevent your flow from triggering every time you receive an email. Trigger conditions can be set so your flow will only trigger when the conditions you set are met (eg. from a specific sender, with specific words in the subject line etc)
Check out this YT Tutorial for more details on how to add Trigger Conditions to your flow: 4 Ways You Can Use Trigger Conditions in Your Microsoft Power Automate Flow
If you are using an Automated Cloud flow trigger in your flow—you need to consider adding trigger conditions.
Do YOU 🫵 know what a trigger condition is? Trigger conditions can be set in most flow triggers. These conditions you set must be true for the trigger to fire. In this Power Automate tutorial, I’m going to show you how to use trigger conditions in your flows to control when your Power Automate flows trigger.
If your plan has flow run limits—you can avoid triggering your flows unnecessarily by using trigger conditions.
I’ll cover four different flow examples that would benefit from trigger conditions:
⚡️ Triggering a flow when a column is changed to a specific value
⚡️ Triggering a Flow When an Event Updated or Deleted
⚡️ Triggering a Flow When a New Folder is Created
⚡️ Triggering a Flow When a Specific Email is Received I’ll also show you a trick on how to easily create the expressions needed and give you a few tips on how to troubleshoot your flow.
IN THIS VIDEO:
✅ Four different flows that would benefit from trigger conditions
✅ What is a trigger condition?
✅ How to add a trigger condition to your flow
✅ How to trigger a flow when a column is changed to a specific value
✅ How to trigger a flow when an event is updated or Deleted
✅ How to trigger a flow when a new folder is created
✅ How to trigger a flow when a specific email is received
✅ How to troubleshoot a trigger condition
✅ How to prevent case sensitivity issues with a trigger condition
✅ How to use the filter array action to easily compose an expression that can be used in a trigger condition
Manual Trigger
I would recommend creating a manually triggered flow and using an email to run tests on. It's always a good idea to have a copy of a manually triggered flow. This way you can troubleshoot your flow at a later date (should you need to).. or use it for testing modifications you'd like to make to your existing flow.
You'll need to grab the email ID from a previous flow run.

A text file will open. You'll need to search for the id. Highlight the id between the double-quote marks and copy it to your clipboard.

Add a Get email (V2) action to your flow. Paste the ID into the Message ID field. If you'd like to include attachments, ensure you change the Include Attachments dropdown to Yes.

Get the Subject Line
The Compose action is optional. I like using Compose actions in my flow to help with troubleshooting. Insert the Subject dynamic content into the Compose action. Also, since you'll be replacing the trigger with an automated trigger, it'll be easier to replace the dynamic content in the Compose action rather than having to replace it in multiple actions in subsequent actions.
Tip: Rename your actions to keep your flow organized. Especially when using multiple instances of an action.

List Tasks
Add the List tasks action to your flow. This will return a list of all the tasks in the selected plan.

Filter Tasks
As mentioned earlier, you don't want to loop through each task to run a check if a task name matches your email subject line. This is inefficient. Instead, use a Filter Array action to filter our your tasks to see if any of them match, then you can create a task (if none of them match) or update an existing task.
In the From field, insert the value dynamic content from the List Tasks action. In the first value field, insert the value Title dynamic content from the List Tasks action. Leave the operator as is equal to. In the second value field, insert the output from the Compose action storing the Subject Line. If you chose not to use the Compose action, insert the Subject Line dynamic content from the Get email (V2) action.

Return Task Count
Whenever I use a Filter Array action, I always like to return the count of items returned in a Compose action. This is helpful when building a flow and can also be used to troubleshoot your flow. Insert a Compose action. Add an Expression. Use the length() function.

Select the Dynamic content tab and insert the body dynamic content from the Filter Array action into the length() function.

Run a test. Review the output of the Compose action. If the Compose action displays a zero this means no tasks match, if it displays a number it means there are that many tasks that match your email subject line.
Important, if you are expecting the Filter Array action to return items and it returns a zero you'll need to troubleshoot your Filter Array action. Check out the troubleshooting YT Tutorial I've linked below.

... more to come
----
In the meantime, these tutorials might be helpful:
To learn more about how to use the Filter Array action, please refer to this YT Tutorial: Are you using the Microsoft Power Automate Filter Array Action wrong?
In this video tutorial I’ll show you 3 practical ways to use the Filter Array action and how to use it properly.
1️⃣ Cross-Referencing Data
2️⃣ Filtering by Key
3️⃣ Substring Matching
Did you know that the Condition action has a limit of 10 conditions? Although it might look like the Filter Array action can only accept one condition—this is not true. By using the advanced mode you can enter multiple conditions into a Filter Array action with an expression.
IN THIS VIDEO:
✅ 3 Ways to Use the Filter Array Action
✅ How to use the Scope Action to Group Actions
✅ How to Check the Number of Items returned from a Filter Array Action
✅ How to Cross-Reference Data in Excel with a SharePoint List
✅ How the Filter Array Action Works
✅ How to Access the Dynamic Content from a Filter Array Action
✅ How to Filter Items by a Key
✅ How to Filter Items by Matching a Substring
✅ How to Use Multiple Conditions in a Filter Array Action
5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows
In this Power Automate tutorial, I explore 5 frequently asked questions that pop up when troubleshooting a flow. If you’d like to to level up your Power Automate flow skills and learn how to troubleshoot your Power Automate flow—this tutorial is for you!
IN THIS VIDEO:
✅ How to troubleshoot a false Condition action result
✅ How to get dynamic content when it isn’t selectable from the list of dynamic content
✅ How to troubleshoot an Apply to Each action that isn’t looping through
✅ How to troubleshoot a skipped Apply to Each action
✅ How to troubleshoot a Filter Query
✅ How to use a SharePoint yes/no column in a Filter Query
✅ How to use Compose actions to troubleshoot a Power Automate flow
✅ How to troubleshoot multiple emails being sent
✅ How to troubleshoot multiple Teams messages being sent
-----
How to Email Attachments 🖇 to Your Planner Tasks
When you add attachments to a Planner task from your computer, the files are automatically saved in the Documents document library of the SharePoint site associated with the M365 Group of your plan. Instead of downloading email attachments to OneDrive or SharePoint just so you can add them to a Planner Task—automate it.
In this Microsoft Power Automate Tutorial—I’m going to show you how build a flow that will take your email attachments and add them to a Planner task. All you need to do is copy a link to a task, forward the email to yourself and the attachments will be saved onto SharePoint and attached to your planner task.
At the end of the video I’ll show you how to use Trigger Conditions so this automation only runs when specific conditions are met.
IN THIS VIDEO:
✅ How to get the Message ID from an Email
✅ How to use the Get an Email (V2) action with a Manual Trigger
✅ How to use the split() function to split an email subject line
✅ How to use the Scope action to group your actions
✅ How to create a folder for email attachments on SharePoint
✅ How to use the Get Attachment (V2) action
✅ How to create attachment files in SharePoint
✅ How to use the Append to Array variable action to collect attachments
✅ How to add multiple attachments to a Planner Task
✅ How to switch a manual trigger to an automated trigger
✅ How to use Trigger Conditions in a when a New Email Arrives Trigger
✅ How to trigger your flow when only specific emails arrive