<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Databricks Workflow Task Failure - Custom Error Messages in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/databricks-workflow-task-failure-custom-error-messages/m-p/169890#M56186</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/96188"&gt;@ChristianRRL&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;
&lt;P class="PlaygroundEditorTheme__paragraph"&gt;&lt;SPAN&gt;When a Python wheel/notebook/script task fails, Jobs always does three things:&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL class="PlaygroundEditorTheme__ol1"&gt;
&lt;LI class="PlaygroundEditorTheme__listItem" value="1"&gt;&lt;SPAN&gt;Render the Python traceback&amp;nbsp;in task output (IPython / Databricks REPL&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;STRONG class="PlaygroundEditorTheme__textBold"&gt;showtraceback&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="PlaygroundEditorTheme__listItem" value="2"&gt;&lt;SPAN&gt;Extract a one-line summary&amp;nbsp;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;STRONG class="PlaygroundEditorTheme__textBold"&gt;RuntimeError: &amp;lt;your message&amp;gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN&gt;), which is the yellow line at the bottom of your screenshot.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="PlaygroundEditorTheme__listItem" value="3"&gt;&lt;SPAN&gt;Set the task termination message&amp;nbsp;to &lt;/SPAN&gt;&lt;STRONG&gt;&lt;STRONG class="PlaygroundEditorTheme__textBold"&gt;Workload failed, see run output for details.&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN&gt; That string is a fixed platform copy for “user code failed.” You cannot replace it with your custom message.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P class="PlaygroundEditorTheme__paragraph"&gt;&lt;SPAN&gt;Python wheel tasks are executed as notebook commands, so they receive the same wrapping. Jobs already strips some internal wheel frames, but your&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;STRONG class="PlaygroundEditorTheme__textBold"&gt;main()&amp;nbsp;/&amp;nbsp;raise&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;frames stay.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="PlaygroundEditorTheme__paragraph"&gt;&lt;SPAN&gt;There is&amp;nbsp;no supported API&amp;nbsp;today to fail a task with&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;&lt;EM class="PlaygroundEditorTheme__textItalic"&gt;only&lt;/EM&gt;&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;a custom string and no traceback &lt;/SPAN&gt;&lt;STRONG&gt;&lt;STRONG class="PlaygroundEditorTheme__textBold"&gt;(dbutils.notebook.exit(...)).&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;Also, it does&amp;nbsp;not&amp;nbsp;fail the task; it succeeds and returns a value.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="PlaygroundEditorTheme__paragraph"&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 26 Sep 2026 06:47:08 GMT</pubDate>
    <dc:creator>K_Anudeep</dc:creator>
    <dc:date>2026-09-26T06:47:08Z</dc:date>
    <item>
      <title>Databricks Workflow Task Failure - Custom Error Messages</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-workflow-task-failure-custom-error-messages/m-p/169842#M56177</link>
      <description>&lt;P&gt;Hi there, kind of silly question but I'm hoping there's a simple way to address this.&lt;/P&gt;&lt;P&gt;I'm trying to make sure that when certain job failure conditions arise, that a workflow task step fails. I've tried this with both raise RuntimeError and sys.exit, but in both cases I'm seeing more in the output than I would like.&lt;/P&gt;&lt;P&gt;I would like to output the most minimal amount of text so that users who are troubleshooting can easily read the custom error message we are outputing.&lt;/P&gt;&lt;P&gt;Is there another/better approach to what I'm trying to do, or is this a Databricks limitation in how raised errors or system exit messages are output?&lt;/P&gt;&lt;P&gt;Also, would one be recommended over the other (raised exception vs system exit)?&lt;/P&gt;&lt;P&gt;Below are examples for both:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristianRRL_0-1790348230722.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/31504i1C9A956EDB45F7AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristianRRL_0-1790348230722.png" alt="ChristianRRL_0-1790348230722.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristianRRL_0-1790348341444.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/31505i7D08D23D25B229A1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristianRRL_0-1790348341444.png" alt="ChristianRRL_0-1790348341444.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2026 15:03:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-workflow-task-failure-custom-error-messages/m-p/169842#M56177</guid>
      <dc:creator>ChristianRRL</dc:creator>
      <dc:date>2026-09-25T15:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks Workflow Task Failure - Custom Error Messages</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-workflow-task-failure-custom-error-messages/m-p/169890#M56186</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/96188"&gt;@ChristianRRL&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;
&lt;P class="PlaygroundEditorTheme__paragraph"&gt;&lt;SPAN&gt;When a Python wheel/notebook/script task fails, Jobs always does three things:&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL class="PlaygroundEditorTheme__ol1"&gt;
&lt;LI class="PlaygroundEditorTheme__listItem" value="1"&gt;&lt;SPAN&gt;Render the Python traceback&amp;nbsp;in task output (IPython / Databricks REPL&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;STRONG class="PlaygroundEditorTheme__textBold"&gt;showtraceback&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="PlaygroundEditorTheme__listItem" value="2"&gt;&lt;SPAN&gt;Extract a one-line summary&amp;nbsp;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;STRONG class="PlaygroundEditorTheme__textBold"&gt;RuntimeError: &amp;lt;your message&amp;gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN&gt;), which is the yellow line at the bottom of your screenshot.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="PlaygroundEditorTheme__listItem" value="3"&gt;&lt;SPAN&gt;Set the task termination message&amp;nbsp;to &lt;/SPAN&gt;&lt;STRONG&gt;&lt;STRONG class="PlaygroundEditorTheme__textBold"&gt;Workload failed, see run output for details.&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN&gt; That string is a fixed platform copy for “user code failed.” You cannot replace it with your custom message.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P class="PlaygroundEditorTheme__paragraph"&gt;&lt;SPAN&gt;Python wheel tasks are executed as notebook commands, so they receive the same wrapping. Jobs already strips some internal wheel frames, but your&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;STRONG class="PlaygroundEditorTheme__textBold"&gt;main()&amp;nbsp;/&amp;nbsp;raise&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;frames stay.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="PlaygroundEditorTheme__paragraph"&gt;&lt;SPAN&gt;There is&amp;nbsp;no supported API&amp;nbsp;today to fail a task with&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;&lt;EM class="PlaygroundEditorTheme__textItalic"&gt;only&lt;/EM&gt;&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;a custom string and no traceback &lt;/SPAN&gt;&lt;STRONG&gt;&lt;STRONG class="PlaygroundEditorTheme__textBold"&gt;(dbutils.notebook.exit(...)).&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;Also, it does&amp;nbsp;not&amp;nbsp;fail the task; it succeeds and returns a value.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="PlaygroundEditorTheme__paragraph"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2026 06:47:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-workflow-task-failure-custom-error-messages/m-p/169890#M56186</guid>
      <dc:creator>K_Anudeep</dc:creator>
      <dc:date>2026-09-26T06:47:08Z</dc:date>
    </item>
  </channel>
</rss>

