<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Add more details to the fatal FlatJSPackage error message</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=123030175" />
  <subtitle>Add more details to the fatal FlatJSPackage error message</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=123030175</id>
  <updated>2026-04-27T11:15:19Z</updated>
  <dc:date>2026-04-27T11:15:19Z</dc:date>
  <entry>
    <title>RE: Add more details to the fatal FlatJSPackage error message</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=123084240" />
    <author>
      <name>Jamie Sammons</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=123084240</id>
    <updated>2024-11-19T16:34:41Z</updated>
    <published>2024-11-19T16:34:40Z</published>
    <summary type="html">&lt;p&gt;Feature Request Created: https://liferay.atlassian.net/browse/LPD-42483&lt;/p&gt;</summary>
    <dc:creator>Jamie Sammons</dc:creator>
    <dc:date>2024-11-19T16:34:40Z</dc:date>
  </entry>
  <entry>
    <title>Add more details to the fatal FlatJSPackage error message</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=123030174" />
    <author>
      <name>Jan Tošovský</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=123030174</id>
    <updated>2024-10-17T10:33:12Z</updated>
    <published>2024-10-17T10:33:11Z</published>
    <summary type="html">&lt;p&gt;Recently I had to recover the server from a backup after clearing the
  /osgi/state, because I was getting &amp;quot;A JS module with the same
  name already exists&amp;quot; exception when the server was restarted.
  There are over 100 custom modules in my instance and it was unclear
  which one is faulty. The issue was fatal as I couldn't even show the
  login page.&lt;/p&gt;
&lt;p&gt;Later I was able to detect the problematic module by tweaking the
  relevant code, which now prints the given module details:&lt;br&gt; https://github.com/liferay/liferay-portal/blob/master/modules/apps/frontend-js/frontend-js-loader-modules-extender/src/main/java/com/liferay/frontend/js/loader/modules/extender/internal/npm/flat/FlatJSPackage.java&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;if (_jsModules.putIfAbsent(jsModule.getName(), jsModule) != null) {
	throw new IllegalStateException(
		&amp;quot;A JS module with the same name &amp;quot; + jsModule.getName() + &amp;quot; (&amp;quot; + getId() + &amp;quot;) already exists in &amp;quot; + _jsModules.get(jsModule.getName()).getJSPackage().getId());
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It would be nice to have something like this directly in the LR code.
  After removing that module (a JSP override containing a main.js file)
  the server restarted successfully. Once that module was redeployed, no
  similar exception was thrown anymore (it will be thrown next time the
  /osgi/state/ is cleared).&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</summary>
    <dc:creator>Jan Tošovský</dc:creator>
    <dc:date>2024-10-17T10:33:11Z</dc:date>
  </entry>
</feed>
