halo-dev/halo · warning · IllegalArgumentException

Plugin name must not be blank

Error message

Plugin name must not be blank

What it means

Thrown as IllegalArgumentException by DefaultPluginGetter.getPlugin when the supplied name is null, empty, or whitespace-only. The getter fetches a Plugin by name from the ExtensionClient; a blank name is a programmer error, not a not-found condition (not-found yields NotFoundException separately).

Source

Thrown at application/src/main/java/run/halo/app/plugin/DefaultPluginGetter.java:24

import run.halo.app.core.extension.Plugin;
import run.halo.app.extension.ExtensionClient;
import run.halo.app.infra.exception.NotFoundException;

/**
 * Default implementation of {@link PluginGetter}.
 *
 * @author guqing
 * @since 2.17.0
 */
@Component
@RequiredArgsConstructor
public class DefaultPluginGetter implements PluginGetter {
    private final ExtensionClient client;

    @Override
    public Plugin getPlugin(String name) {
        if (StringUtils.isBlank(name)) {
            throw new IllegalArgumentException("Plugin name must not be blank");
        }
        return client.fetch(Plugin.class, name).orElseThrow(() -> new NotFoundException("Plugin not found"));
    }
}

View on GitHub (pinned to d2f5165f9c)

Solutions

  1. Validate the name is non-blank before calling getPlugin and return 400 if it is.
  2. Ensure the caller always supplies a populated plugin identifier.
  3. Check upstream that the variable resolving the name is not null/empty.

Example fix

// before
Plugin p = pluginGetter.getPlugin(req.getName()); // name null

// after
if (!StringUtils.hasText(req.getName())) {
    throw new ServerWebInputException("plugin name is required");
}
Plugin p = pluginGetter.getPlugin(req.getName());
Defensive patterns

Strategy: validation

Validate before calling

if (!StringUtils.hasText(name)) {
    throw new ServerWebInputException("Plugin name is required");
}
Plugin p = pluginGetter.getPlugin(name);

Type guard

static boolean isNonBlankPluginName(String s) {
    return s != null && !s.trim().isEmpty();
}

Try / catch

try {
    pluginGetter.getPlugin(name);
} catch (IllegalArgumentException e) {
    throw new ServerWebInputException("Plugin name must not be blank", null, e);
} catch (NotFoundException e) {
    return ServerResponse.notFound().build();
}

Prevention

When it happens

Trigger: Calling pluginGetter.getPlugin(name) with a blank/null name: an unvalidated request path variable, a missing form field, or a programmatic caller passing an uninitialized variable.

Common situations: A controller/endpoint forwarding an empty path variable; a frontend omitting the plugin name; a null returned from a lookup that is passed straight through; defensive code missing before delegating.

Related errors


AI-assisted analysis of halo-dev/halo@d2f5165f9c (2026-08-14). Data as JSON: /api/errors/769e84438bd12d96. Report an issue: GitHub.