<?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 Fabric notebook Py4JJavaError - underlying location does not exist in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-notebook-Py4JJavaError-underlying-location-does-not-exist/m-p/5225926#M16808</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are getting the following error on our Fabric notebook via pipeline runs -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Py4JJavaError

An error occurred &lt;SPAN class=""&gt;while&lt;/SPAN&gt; calling o6734.collectToPython. : org.apache.spark.SparkException: Job aborted due to stage failure: Task &lt;SPAN class=""&gt;0&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; stage &lt;SPAN class=""&gt;18.0&lt;/SPAN&gt; failed &lt;SPAN class=""&gt;4&lt;/SPAN&gt; times, most recent failure: Lost task &lt;SPAN class=""&gt;0.3&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; stage &lt;SPAN class=""&gt;18.0&lt;/SPAN&gt; (TID &lt;SPAN class=""&gt;23&lt;/SPAN&gt;) (vm-4f039835 executor &lt;SPAN class=""&gt;1&lt;/SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; com.microsoft.sqlserver.jdbc.SQLServerException: An error occurred during the current command (Done status &lt;SPAN class=""&gt;0&lt;/SPAN&gt;). Failed to complete the command because the underlying location does &lt;SPAN class=""&gt;not&lt;/SPAN&gt; exist. Underlying data description: table &lt;SPAN class=""&gt;'\&amp;lt;lakehouse table path\&amp;gt;'&lt;/SPAN&gt;, file &lt;SPAN class=""&gt;'\&amp;lt;lakehouse table url\&amp;gt;'&lt;/SPAN&gt;.&lt;/PRE&gt;&lt;P&gt;The code is below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;import&lt;/SPAN&gt; com.microsoft.spark.fabric
&lt;SPAN class=""&gt;from&lt;/SPAN&gt; com.microsoft.spark.fabric.Constants &lt;SPAN class=""&gt;import&lt;/SPAN&gt; Constants

spark = SparkSession.builder.appName(&lt;SPAN class=""&gt;"create_availability"&lt;/SPAN&gt;).getOrCreate()


&lt;SPAN class=""&gt;# Build SQL query to find min and max date from source view&lt;/SPAN&gt;
query = &lt;SPAN class=""&gt;"SELECT MIN(week_start_date) AS earliest_date, MAX(week_start_date) AS latest_date FROM schema.source_view"&lt;/SPAN&gt;

&lt;SPAN class=""&gt;# Load from SQL endpoint&lt;/SPAN&gt;
table_load_spark = (
    spark.read.option(Constants.WorkspaceId, WS_ID)
    .option(Constants.DatabaseName, LAKEHOUSE_NAME)
    .synapsesql(query)
)

dates = table_load_spark.first()&lt;/PRE&gt;&lt;P&gt;The failure is coming from the last line. Going through the traceback it is more specifically failing when running collectToPython.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Our source view is in a Lakehouse shortcut. It is in the same schema as tables we do not have permission to view or refresh, so the Spark job must be accessing these forbidden tables while running the above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The failure is specifically happening when the notebook is ran via pipeline on our scheduled runs managed by service principal. The SP has workspace and item access to the Lakehouse and SQL Endpoint in question, so we can't see any overt permission problems. Also this method works in another workspace with the same permissions, so it must an issue with this shortcut.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jun 2026 08:08:23 GMT</pubDate>
    <dc:creator>bekkac579</dc:creator>
    <dc:date>2026-06-22T08:08:23Z</dc:date>
    <item>
      <title>Fabric notebook Py4JJavaError - underlying location does not exist</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-notebook-Py4JJavaError-underlying-location-does-not-exist/m-p/5225926#M16808</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are getting the following error on our Fabric notebook via pipeline runs -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Py4JJavaError

An error occurred &lt;SPAN class=""&gt;while&lt;/SPAN&gt; calling o6734.collectToPython. : org.apache.spark.SparkException: Job aborted due to stage failure: Task &lt;SPAN class=""&gt;0&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; stage &lt;SPAN class=""&gt;18.0&lt;/SPAN&gt; failed &lt;SPAN class=""&gt;4&lt;/SPAN&gt; times, most recent failure: Lost task &lt;SPAN class=""&gt;0.3&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; stage &lt;SPAN class=""&gt;18.0&lt;/SPAN&gt; (TID &lt;SPAN class=""&gt;23&lt;/SPAN&gt;) (vm-4f039835 executor &lt;SPAN class=""&gt;1&lt;/SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; com.microsoft.sqlserver.jdbc.SQLServerException: An error occurred during the current command (Done status &lt;SPAN class=""&gt;0&lt;/SPAN&gt;). Failed to complete the command because the underlying location does &lt;SPAN class=""&gt;not&lt;/SPAN&gt; exist. Underlying data description: table &lt;SPAN class=""&gt;'\&amp;lt;lakehouse table path\&amp;gt;'&lt;/SPAN&gt;, file &lt;SPAN class=""&gt;'\&amp;lt;lakehouse table url\&amp;gt;'&lt;/SPAN&gt;.&lt;/PRE&gt;&lt;P&gt;The code is below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;import&lt;/SPAN&gt; com.microsoft.spark.fabric
&lt;SPAN class=""&gt;from&lt;/SPAN&gt; com.microsoft.spark.fabric.Constants &lt;SPAN class=""&gt;import&lt;/SPAN&gt; Constants

spark = SparkSession.builder.appName(&lt;SPAN class=""&gt;"create_availability"&lt;/SPAN&gt;).getOrCreate()


&lt;SPAN class=""&gt;# Build SQL query to find min and max date from source view&lt;/SPAN&gt;
query = &lt;SPAN class=""&gt;"SELECT MIN(week_start_date) AS earliest_date, MAX(week_start_date) AS latest_date FROM schema.source_view"&lt;/SPAN&gt;

&lt;SPAN class=""&gt;# Load from SQL endpoint&lt;/SPAN&gt;
table_load_spark = (
    spark.read.option(Constants.WorkspaceId, WS_ID)
    .option(Constants.DatabaseName, LAKEHOUSE_NAME)
    .synapsesql(query)
)

dates = table_load_spark.first()&lt;/PRE&gt;&lt;P&gt;The failure is coming from the last line. Going through the traceback it is more specifically failing when running collectToPython.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Our source view is in a Lakehouse shortcut. It is in the same schema as tables we do not have permission to view or refresh, so the Spark job must be accessing these forbidden tables while running the above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The failure is specifically happening when the notebook is ran via pipeline on our scheduled runs managed by service principal. The SP has workspace and item access to the Lakehouse and SQL Endpoint in question, so we can't see any overt permission problems. Also this method works in another workspace with the same permissions, so it must an issue with this shortcut.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2026 08:08:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-notebook-Py4JJavaError-underlying-location-does-not-exist/m-p/5225926#M16808</guid>
      <dc:creator>bekkac579</dc:creator>
      <dc:date>2026-06-22T08:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Fabric notebook Py4JJavaError - underlying location does not exist</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-notebook-Py4JJavaError-underlying-location-does-not-exist/m-p/5226623#M16817</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1351441"&gt;@bekkac579&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The failure happens only when run via pipeline states that its a SQL Analytics endpoint metadata sync issue. You can add a refresh Sql endpoint activity before calling this code in your pipeline and try once, else you can refresh the query within the code itself. Write a sample warm-up query to activate your SQL endpoint before hitting the actual table and querying it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Refer link here to understand on this issue -&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/sql-analytics-endpoint-metadata-sync" target="_blank"&gt;SQL Analytics Endpoint Metadata Sync - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if the above solution works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ati Puri&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2026 12:30:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-notebook-Py4JJavaError-underlying-location-does-not-exist/m-p/5226623#M16817</guid>
      <dc:creator>ati_puri</dc:creator>
      <dc:date>2026-06-22T12:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Fabric notebook Py4JJavaError - underlying location does not exist</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-notebook-Py4JJavaError-underlying-location-does-not-exist/m-p/5229097#M16833</link>
      <description>&lt;P&gt;We added a notebook to refresh sql metadata into the pipeline, seems to be working now, thank you !&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2026 09:10:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-notebook-Py4JJavaError-underlying-location-does-not-exist/m-p/5229097#M16833</guid>
      <dc:creator>bekkac579</dc:creator>
      <dc:date>2026-06-23T09:10:38Z</dc:date>
    </item>
  </channel>
</rss>

