elastic/elasticsearch · error · UserException

64

64

Error message

At least one plugin ID is required

What it means

Thrown by RemovePluginAction.execute when the list of plugins to remove is null or empty. The CLI refuses to proceed without at least one target id; exit code is USAGE (64). This is the input-validation gate before ensurePluginsNotUsedByOtherPlugins and per-plugin removal.

Source

Thrown at distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/cli/RemovePluginAction.java:75

        this.purge = purge;
    }

    public void setPurge(boolean purge) {
        this.purge = purge;
    }

    /**
     * Remove the plugin specified by {@code pluginName}.
     *
     * @param plugins    the IDs of the plugins to remove
     * @throws IOException   if any I/O exception occurs while performing a file operation
     * @throws UserException if plugins is null or empty
     * @throws UserException if plugin directory does not exist
     * @throws UserException if the plugin bin directory is not a directory
     */
    public void execute(List<InstallablePlugin> plugins) throws IOException, UserException {
        if (plugins == null || plugins.isEmpty()) {
            throw new UserException(ExitCodes.USAGE, "At least one plugin ID is required");
        }

        ensurePluginsNotUsedByOtherPlugins(plugins);

        for (InstallablePlugin plugin : plugins) {
            checkCanRemove(plugin);
        }

        for (InstallablePlugin plugin : plugins) {
            removePlugin(plugin);
        }
    }

    private void ensurePluginsNotUsedByOtherPlugins(List<InstallablePlugin> plugins) throws IOException, UserException {
        // First make sure nothing extends this plugin
        final Map<String, List<String>> usedBy = new HashMap<>();

        // We build a new map where the keys are plugins that extend plugins

View on GitHub (pinned to db6a809a66)

Solutions

  1. Pass one or more plugin ids: `elasticsearch-plugin remove <id> [<id>...]`.
  2. In scripted callers, check the list is non-empty before invoking remove.
  3. If you intended to list plugins, use `elasticsearch-plugin list` instead.

Example fix

# before:
bin/elasticsearch-plugin remove          # no ids
# after:
bin/elasticsearch-plugin remove analysis-icu store-smb
Defensive patterns

Strategy: validation

Validate before calling

// Ensure non-empty plugin list before calling execute.
if (plugins == null || plugins.isEmpty()) {
    throw new IllegalArgumentException("At least one plugin id required for removal");
}

Prevention

When it happens

Trigger: execute(List<InstallablePlugin> plugins) is called with null or an empty list; the guard throws UserException(USAGE) immediately. Reached via `elasticsearch-plugin remove` invoked with no plugin ids (and no default), or via programmatic callers that pass an empty list.

Common situations: Running `elasticsearch-plugin remove` with no arguments; scripting layer that builds the args from an empty list; argparse equivalent that allows zero ids.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/b348218848e6e59a. Report an issue: GitHub.