Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
hameed4ru
Frequent Visitor

Error Handling in Dataflow Pipelines

Hi Team,

I have one pipeline sequence where it will run multiple dataflow's with interdependence. I have designed a job in such a way that on each successful completion of one dataflow-1 another will trigger and incase of failure I need to send a mail-notification to the corresponding team-members about the stats of the Error like failed dataflow/pipeline name and the reason for the failure of the dataflow. 

I did a workaround to capture the errors in Notebook where I connected all the on-fail connections from all the dataflows to single NoteBook and I connected back this notebook to outlook. Here Iam using the following scirpt to capture the errros and show in the Outlook but its not working as I desired. Please let me know if anyone has come across such a scenario in your projects.

from datetime import datetime
from notebookutils import mssparkutils

# -------------------------------
# CONFIG: List of dataflows to check
dataflows = [
    "df_dataflow-1", "df_dataflow-2", "df_dataflow-3",
    "df_dataflow-5", "df_dataflow-4", "df_dataflow-6",
    "df_dataflow-8", "df_dataflow-7", "df_dataflow-9",
    "df_dataflow-10"
]

failed_flows = []

# -------------------------------
# LOOP: Check status and error for each flow
for flow in dataflows:
    try:
        output = mssparkutils.pipeline.getActivityOutput(flow)
        status = output.get("status", "Unknown")
        if status != "Succeeded":
            error_detail = output.get("error", {}).get("message", "No error message available")
            failed_flows.append((flow, error_detail))
    except Exception as e:
        failed_flows.append((flow, f"⚠️ Status unknown or error occurred: {str(e)}"))

# -------------------------------
# COMPOSE HTML MESSAGE
if failed_flows:
    rows = "".join(
        f"<tr><td>{flow}</td><td>{error}</td></tr>"
        for flow, error in failed_flows
    )
    message = f"""
    <html>
    <body>
    <h2 style='color:red;'>🚨 Pipeline Failure Alert</h2>
    <p>The following dataflows failed in the pipeline:</p>
    <table border='1' cellpadding='5' cellspacing='0' style='border-collapse: collapse;'>
        <tr style='background-color: #f2f2f2;'><th>Dataflow Name</th><th>Error Message</th></tr>
        {rows}
    </table>
    <p><b>Timestamp:</b> {datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')} UTC</p>
    <p>Please check <a href='https://app.fabric.microsoft.com/'>Microsoft Fabric Pipeline Monitor</a> for details.</p>
    </body>
    </html>
    """
else:
    message = f"""
    <html>
    <body>
    <h2 style='color:green;'> All Dataflows Succeeded</h2>
    <p>No errors detected in the pipeline execution.</p>
    <p><b>Timestamp:</b> {datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')} UTC</p>
    </body>
    </html>
    """

# -------------------------------
# OUTPUT HTML MESSAGE TO PIPELINE
mssparkutils.notebook.exit(message)
 

Thanks,

Hameed

 

2 ACCEPTED SOLUTIONS
v-sgandrathi
Community Support
Community Support

Hi @hameed4ru,

Thank you for reaching out to the Microsoft Fabric Community.

 

You're on the right track by routing failed dataflows to a central notebook for error reporting and notifications. However, the issue you're facing is likely due to the use of mssparkutils.pipeline.getActivityOutput(), which only returns output for successful activities. This behavior is confirmed in Microsoft’s documentation here:
Microsoft Spark Utilities (MSSparkUtils) for Fabric - Microsoft Fabric | Microsoft Learn

 

To make your solution more reliable, we recommend passing the failure context (e.g., dataflow name and error message) directly to the notebook via pipeline parameters when a dataflow fails. These can then be retrieved using mssparkutils.pipeline.getInputParameters() inside the notebook.

 

For your reference, I am also including the link that has already been accepted by the community.Please have a look for better understandingSolved: Is it possible to pass parameter from notebook act... - Microsoft Fabric Community

 

Parameters - Microsoft Fabric | Microsoft Learn

 

Additionally, ensure your Outlook activity is configured to handle HTML content correctly to avoid formatting issues during email delivery.

We suggest replacing the output polling logic with parameter passing through failure branches. It’s simpler, more reliable, and fully supported within Fabric’s orchestration framework.

 

If this solution worked for you, kindly mark it as Accept as Solution and feel free to give a Kudos, it would be much appreciated!

 

Thank you,
Sahasra

 

View solution in original post

Hi @hameed4ru,

 

We wanted to follow up to see if our suggestion was helpful. Please let us know how things are progressing and if you are still encountering any issues.

If the response resolved your problem, you may mark it as the solution and give it a thumbs up to assist others in the community as well.

 

Thank you.

View solution in original post

6 REPLIES 6
hameed4ru
Frequent Visitor

Hi Team,

I did a workaround to achieve this in the MailBody, where I used the combination of htmlCode to create a html-table. I configured the outlook html table to show the status of each and every dataflow as follows.

@activity('dataflow-1').status to check whether the status is success or failed.

 

Yes, your multiple blogs which you have provided has helped me to resolve the issue.

 

Thanks,

Hameed

 

Hi @hameed4ru,

 

Thank you for sharing your update. It's good to know that combining htmlCode with @activity('dataflow-name').status helped you create a clean and functional HTML table in the email body.

I'm glad the resources shared earlier were useful in resolving your issue. Thanks for sharing your solution, as it will be helpful for others facing similar challenges.

Thank you and continue using Microsoft Fabric Community Forum!

v-sgandrathi
Community Support
Community Support

Hi @hameed4ru,

Thank you for reaching out to the Microsoft Fabric Community.

 

You're on the right track by routing failed dataflows to a central notebook for error reporting and notifications. However, the issue you're facing is likely due to the use of mssparkutils.pipeline.getActivityOutput(), which only returns output for successful activities. This behavior is confirmed in Microsoft’s documentation here:
Microsoft Spark Utilities (MSSparkUtils) for Fabric - Microsoft Fabric | Microsoft Learn

 

To make your solution more reliable, we recommend passing the failure context (e.g., dataflow name and error message) directly to the notebook via pipeline parameters when a dataflow fails. These can then be retrieved using mssparkutils.pipeline.getInputParameters() inside the notebook.

 

For your reference, I am also including the link that has already been accepted by the community.Please have a look for better understandingSolved: Is it possible to pass parameter from notebook act... - Microsoft Fabric Community

 

Parameters - Microsoft Fabric | Microsoft Learn

 

Additionally, ensure your Outlook activity is configured to handle HTML content correctly to avoid formatting issues during email delivery.

We suggest replacing the output polling logic with parameter passing through failure branches. It’s simpler, more reliable, and fully supported within Fabric’s orchestration framework.

 

If this solution worked for you, kindly mark it as Accept as Solution and feel free to give a Kudos, it would be much appreciated!

 

Thank you,
Sahasra

 

Hhi @hameed4ru,

 

Just wanted to check regarding your question. We haven’t heard back and want to ensure you're not stuck. If you need anything else or have updates to share, we’re here to help!

If the previous reply resolved your issue, please consider marking it as Accepted and giving it a Kudos to help others find it easily.

 

If it's resolved, feel free to hit Accept as Solution and drop a Kudos.

Hi @hameed4ru,

 

Hope you're doing well! Just following up to see if the response we shared was helpful. If you have any further questions or need clarification, we’re here to assist.

If your issue is resolved, please consider marking the answer as Accepted and giving it a Kudos to help others in the community.

 

Thanks for being a part of the Microsoft Fabric Community!

Hi @hameed4ru,

 

We wanted to follow up to see if our suggestion was helpful. Please let us know how things are progressing and if you are still encountering any issues.

If the response resolved your problem, you may mark it as the solution and give it a thumbs up to assist others in the community as well.

 

Thank you.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.