pinpoint-apm/pinpoint · error · IllegalStateException

Duplicate order found for plugin : ${pluginId}

Error message

Duplicate order found for plugin : ${pluginId}

What it means

PluginJarsProvider.sort throws this IllegalStateException when two plugin jars resolve to the same explicit order value (same pluginId mapped twice into orderedPlugins with a non-null previous value). Plugin load order is deterministic per pluginId; duplicates make ordering ambiguous, so the provider fails fast instead of loading plugins in an unpredictable sequence.

Source

Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/plugin/PluginJarsProvider.java:83

                                             final List<String> orderedPluginIdList) {
        if (CollectionUtils.isEmpty(pluginJarPaths)) {
            return Collections.emptyList();
        }
        List<PluginJar> pluginList = filter(pluginJarPaths, pluginFilter);

        return sort(pluginList, orderedPluginIdList);
    }

    private List<PluginJar> sort(List<PluginJar> pluginList, List<String> orderedPluginIdList) {
        Map<String, PluginJar> orderedPlugins = getOrderedPlugins(orderedPluginIdList);

        List<PluginJar> unorderedPlugins = new ArrayList<>();
        for (PluginJar pluginJar : pluginList) {
            String pluginId = pluginJar.getPluginId();
            if (orderedPlugins.containsKey(pluginId)) {
                PluginJar prev = orderedPlugins.put(pluginId, pluginJar);
                if (prev != null) {
                    throw new IllegalStateException("Duplicate order found for plugin : " + pluginId);
                }
            } else {
                unorderedPlugins.add(pluginJar);
            }
        }
        List<PluginJar> pluginJars = new ArrayList<>();
        for (PluginJar orderedPlugin : orderedPlugins.values()) {
            if (orderedPlugin != null) {
                pluginJars.add(orderedPlugin);
            }
        }
        pluginJars.addAll(unorderedPlugins);
        return pluginJars;
    }

    private List<PluginJar> filter(List<Path> pluginJarPaths, PluginFilter pluginFilter) {
        List<PluginJar> list = new ArrayList<>();
        for (Path pluginJarPath : pluginJarPaths) {

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Remove duplicate plugin jars from the agent's plugin directory, keeping only one jar per pluginId
  2. Ensure only one version of each plugin is deployed (delete older jars)
  3. Verify the plugin order configuration does not repeat a pluginId
  4. Rebuild the custom plugin with a unique pluginId if two separate plugins collide

Example fix

// before
plugin/
  my-plugin-1.0.jar
  my-plugin-1.1.jar   // duplicate pluginId -> IllegalStateException
// after
plugin/
  my-plugin-1.1.jar   // keep only one jar per pluginId
Defensive patterns

Strategy: validation

Validate before calling

Set<String> seen = new HashSet<>();
for (PluginJar jar : pluginList) {
    if (!seen.add(jar.getPluginId())) {
        logger.warn("Duplicate pluginId detected: {}", jar.getPluginId());
    }
}

Try / catch

try {
    List<PluginJar> jars = pluginJarsProvider.get();
} catch (IllegalStateException e) {
    logger.error("Duplicate plugin order detected: {}", e.getMessage());
    throw e;
}

Prevention

When it happens

Trigger: createPluginJars -> sort is called and two PluginJar entries share the same pluginId while also being registered in the ordered plugins map — i.e. duplicate plugin jars on the plugin directory or duplicate order keys in the plugin order configuration.

Common situations: Copying a plugin jar into the Pinpoint plugin directory twice (e.g. foo-plugin-1.0.jar and foo-plugin-1.1.jar producing the same pluginId), or mis-edited plugin order config listing the same plugin twice.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/7bcfc515aa474f26. Report an issue: GitHub.