<?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: Publishing Webtool: &amp;quot;Fails to create the map service definition during staging&amp;quot; in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/publishing-webtool-quot-fails-to-create-the-map/m-p/1685484#M75123</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;When you trying to publish web tool code, ArcGIS makes revision of your code and makes some changes in it.&amp;nbsp;The mangling happens because ArcGIS is trying to do some kind of validation of "path-like strings" against what data sources are registered on ArcGIS Server. Check for differences with your original code.&lt;/P&gt;&lt;P&gt;It is recommended all paths make as parameters for tool. Then you can setup these parameters as constants and don't need to specify each time you run tool.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Feb 2026 12:58:08 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2026-02-20T12:58:08Z</dc:date>
    <item>
      <title>Publishing Webtool: "Fails to create the map service definition during staging"</title>
      <link>https://community.esri.com/t5/python-questions/publishing-webtool-quot-fails-to-create-the-map/m-p/1685418#M75121</link>
      <description>&lt;P&gt;I'm trying to publish a webtool to a federated server in Enterprise. It keeps failing with "Failed to create the map service definition during staging". However, it Analyzes with no errors or warnings. (It also fails if put on the Hosting server).&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;LAFI_Tools 35 WebTool GBP Wyoming Portal 2026-02-19 16:48:47 Status: InProgress StatusMessage: Consolidate data&lt;BR /&gt;LAFI_Tools 35 WebTool GBP Wyoming Portal&amp;nbsp; 2026-02-19 16:48:49 Status: InProgress StatusMessage: Staging GP service&lt;BR /&gt;LAFI_Tools 35 WebTool GBP Wyoming Portal 2026-02-19 16:49:29 Status: Failed ErrorMessage: Consolidation failed&lt;BR /&gt;LAFI_Tools 35 WebTool GBP Wyoming Portal&amp;nbsp; 2026-02-19 16:49:31 Status: InProgress StatusMessage: Failed to create the map service definition during staging.&lt;BR /&gt;LAFI_Tools 35 WebTool GBP Wyoming Portal&amp;nbsp; 2026-02-19 16:49:31 Status: Failed ErrorMessage: ERROR 004017: Failed to create the map service definition during staging.&lt;BR /&gt;LAFI_Tools 35 WebTool GBP Wyoming Portal&amp;nbsp; 2026-02-19 16:49:31 Status: Failed ErrorMessage: Failed to execute (StageService).&lt;BR /&gt;LAFI_Tools 35 WebTool GBP Wyoming Portal&amp;nbsp; 2026-02-19 16:49:33 Status: Failed ErrorMessage: Staging failed&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Here's the thing: I'm not asking for a map service?? Why is it trying to make one?&lt;/P&gt;&lt;P&gt;I have "URL Data: Convert feature layer" unchecked&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlfredBaldenweck_1-1771545382230.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/148679i17F6941AAE00BDC2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlfredBaldenweck_1-1771545382230.png" alt="AlfredBaldenweck_1-1771545382230.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="AlfredBaldenweck_0-1771545369587.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/148678iCA45A96D20479DA8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlfredBaldenweck_0-1771545369587.png" alt="AlfredBaldenweck_0-1771545369587.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've narrowed it down to a set of variables that point to several services. Some are hosted, some are federated. The only data that this tool points to are these services. Nothing on a local geodatabase, or via file path to an eGDB connection.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;''' Variables'''&lt;BR /&gt;inspectbl = (r".../services/Hosted/service_9a4388c5911f40e292c27ffc7fc47f17/FeatureServer/0")&lt;BR /&gt;locattbl = (r".../services/Hosted/service_9a4388c5911f40e292c27ffc7fc47f17/FeatureServer/1")&lt;BR /&gt;aliquot = (r".../services/WYSO_Mobile/.../FeatureServer/3")&lt;BR /&gt;section = (r".../services/WYSO_Mobile/.../FeatureServer/1")&lt;BR /&gt;twnship = (r".../services/WYSO_Mobile/.../FeatureServer/0")&lt;BR /&gt;admu = (r".../services/admin_boundaries/.../MapServer/3")&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If I comment these out, it publishes fine. Of course, that means that I can't use the tool because I commented out these variables and can't uncomment them. once they're up there.&lt;/P&gt;&lt;P&gt;I thought it might be a problem that I was pointing to services on a different server, so I tried publishing with the hosted services commented out, and it still broke.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A colleague suggested just popping these into a JSON file, plugging that in as a parameter, and then parsing it, but that seems like an unnecessary step?&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get around this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks everyone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2026 00:07:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/publishing-webtool-quot-fails-to-create-the-map/m-p/1685418#M75121</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2026-02-20T00:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing Webtool: "Fails to create the map service definition during staging"</title>
      <link>https://community.esri.com/t5/python-questions/publishing-webtool-quot-fails-to-create-the-map/m-p/1685422#M75122</link>
      <description>&lt;P&gt;Update: I tried the config json. The tool runs fine. Analyzing tells me it needs to copy the json file to the server, no biggy.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still fails, same error.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2026 00:32:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/publishing-webtool-quot-fails-to-create-the-map/m-p/1685422#M75122</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2026-02-20T00:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing Webtool: "Fails to create the map service definition during staging"</title>
      <link>https://community.esri.com/t5/python-questions/publishing-webtool-quot-fails-to-create-the-map/m-p/1685484#M75123</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;When you trying to publish web tool code, ArcGIS makes revision of your code and makes some changes in it.&amp;nbsp;The mangling happens because ArcGIS is trying to do some kind of validation of "path-like strings" against what data sources are registered on ArcGIS Server. Check for differences with your original code.&lt;/P&gt;&lt;P&gt;It is recommended all paths make as parameters for tool. Then you can setup these parameters as constants and don't need to specify each time you run tool.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2026 12:58:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/publishing-webtool-quot-fails-to-create-the-map/m-p/1685484#M75123</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2026-02-20T12:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing Webtool: "Fails to create the map service definition during staging"</title>
      <link>https://community.esri.com/t5/python-questions/publishing-webtool-quot-fails-to-create-the-map/m-p/1685558#M75124</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;You mentioned checking for differences with my original code. How do I do that? It doesn't spit out a copy for me to look at, does it?&lt;/P&gt;&lt;P&gt;I tried adding these paths as parameters and was informed that they would be copied to the server because they're not already registered with it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-02-20 101428.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/148699i30133245694A4F86/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2026-02-20 101428.png" alt="Screenshot 2026-02-20 101428.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-02-20 101643.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/148700i4779DCA0CF01022B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2026-02-20 101643.png" alt="Screenshot 2026-02-20 101643.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="Screenshot 2026-02-20 101709.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/148701i673B3FAD351806C4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2026-02-20 101709.png" alt="Screenshot 2026-02-20 101709.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm having a hard time expressing how utterly takenaback by this behaviour I am. There's no reason for it to try to copy services. That's the whole point of pointing to a URL.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I get this to just publish? I don't even know why it's trying to make a map service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2026 17:20:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/publishing-webtool-quot-fails-to-create-the-map/m-p/1685558#M75124</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2026-02-20T17:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing Webtool: "Fails to create the map service definition during staging"</title>
      <link>https://community.esri.com/t5/python-questions/publishing-webtool-quot-fails-to-create-the-map/m-p/1685588#M75125</link>
      <description>&lt;P&gt;Ok, I think I solved it.&lt;/P&gt;&lt;P&gt;I typically add a line break to my strings if they get too long, according to one of the PEPS (8?). It works just fine in a typical script.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        configJSON.value = (r"\\pretendthisisapathtomyfolder\tools"
                            r"\LAFI_Tools\LAFI_Tools_config.json")&lt;/LI-CODE&gt;&lt;P&gt;This works great when running the tool.&lt;/P&gt;&lt;P&gt;However, it does NOT work when trying to upload the tool.&lt;/P&gt;&lt;P&gt;Switching it to a single line solves the problem and lets you upload at the expense of readbility.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        configJSON.value = (r"\\pretendthisisapathtomyfolder\tools\LAFI_Tools\LAFI_Tools_config.json")&lt;/LI-CODE&gt;&lt;P&gt;I'm willing to bet this was the problem the whole time, even when I was just listing the datasources as variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2026 18:41:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/publishing-webtool-quot-fails-to-create-the-map/m-p/1685588#M75125</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2026-02-20T18:41:55Z</dc:date>
    </item>
  </channel>
</rss>

