appsmithorg/appsmith · error · IllegalStateException

Unexpected value: {command}

Error message

Unexpected value: {command}

What it means

Thrown by the default arm of the switch in AwsLambdaPlugin.execute() when the action's 'command' field (read from form data) does not match any of the four recognized commands: LIST_FUNCTIONS, LIST_FUNCTION_VERSIONS, LIST_FUNCTION_ALIASES, or INVOKE_FUNCTION. It is a defensive exhaustive-switch guard. Because it is a raw IllegalStateException (not an AppsmithPluginException), the Reactor pipeline's generic .onErrorMap(Exception.class, ...) later wraps it into a PLUGIN_ERROR (PE-PLG-5000) carrying the same message. Hitting it means the command contract between the editor UI and the plugin backend is out of sync.

Source

Thrown at app/server/appsmith-plugins/awsLambdaPlugin/src/main/java/com/external/plugins/AwsLambdaPlugin.java:82

                DatasourceConfiguration datasourceConfiguration,
                ActionConfiguration actionConfiguration) {

            log.debug(Thread.currentThread().getName() + ": execute() called for AWS Lambda plugin.");
            Map<String, Object> formData = actionConfiguration.getFormData();
            String command = getDataValueSafelyFromFormData(formData, "command", STRING_TYPE);

            return Mono.fromCallable(() -> {
                        log.debug(Thread.currentThread().getName()
                                + ": creating action execution result for AWS Lambda plugin.");
                        ActionExecutionResult result;
                        switch (Objects.requireNonNull(command)) {
                            case "LIST_FUNCTIONS" -> result = listFunctions(actionConfiguration, connection);
                            case "LIST_FUNCTION_VERSIONS" ->
                                result = listFunctionVersions(actionConfiguration, connection);
                            case "LIST_FUNCTION_ALIASES" ->
                                result = listFunctionAliases(actionConfiguration, connection);
                            case "INVOKE_FUNCTION" -> result = invokeFunction(actionConfiguration, connection);
                            default -> throw new IllegalStateException("Unexpected value: " + command);
                        }

                        return result;
                    })
                    .onErrorMap(
                            IllegalArgumentException.class,
                            e -> new AppsmithPluginException(
                                    AppsmithPluginError.PLUGIN_ERROR, "Unsupported command: " + command))
                    .onErrorMap(
                            ResourceNotFoundException.class,
                            e -> new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, e.getErrorMessage()))
                    .onErrorMap(
                            Exception.class,
                            e -> new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, e.getMessage()))
                    .map(obj -> obj)
                    .subscribeOn(Schedulers.boundedElastic());
        }

View on GitHub (pinned to 8cd9021c24)

Solutions

  1. Open the action in the Appsmith editor and set the Command dropdown to one of: List Functions, List Function Versions, List Function Aliases, or Invoke Function.
  2. If the action was imported or migrated, re-select the command from the dropdown so valid form data is rewritten.
  3. Ensure the deployed plugin JAR version matches the editor's plugin specification — redeploy or update the plugin.
  4. If calling execute() programmatically, validate the command string against the known set before invoking.

Example fix

// before — invalid command in form data
Map<String, Object> formData = Map.of("command", "DELETE_FUNCTION");

// after — valid command
Map<String, Object> formData = Map.of("command", "INVOKE_FUNCTION");
Defensive patterns

Strategy: validation

Validate before calling

private static final Set<String> VALID_COMMANDS = Set.of(
    "LIST_FUNCTIONS", "LIST_FUNCTION_VERSIONS",
    "LIST_FUNCTION_ALIASES", "INVOKE_FUNCTION");

String command = getDataValueSafelyFromFormData(form.getFormData(), "command", STRING_TYPE);
if (!VALID_COMMANDS.contains(command)) {
    throw new IllegalArgumentException(
        "Invalid AWS Lambda command: " + command + ". Expected one of " + VALID_COMMANDS);
}

Try / catch

// In a Reactor pipeline calling plugin.execute():
.execute()
.onErrorMap(IllegalStateException.class,
    e -> new AppsmithPluginException(
        AppsmithPluginError.PLUGIN_ERROR,
        "Unknown AWS Lambda command. Valid: LIST_FUNCTIONS, LIST_FUNCTION_VERSIONS, LIST_FUNCTION_ALIASES, INVOKE_FUNCTION"))
.onErrorResume(AppsmithPluginException.class, e -> Mono.just(errorResult(e)));

Prevention

When it happens

Trigger: Calling AwsLambdaPlugin.execute() with actionConfiguration form data whose 'command' key holds a value outside the four known constants — e.g. null, an empty string, 'DELETE_FUNCTION', a misspelling, or a value from a newer/older plugin specification that the running JAR does not enumerate.

Common situations: Plugin JAR version mismatch where the editor sends a command the backend does not recognize yet; an imported or manually edited action whose JSON carries a stale or invalid command; a migration between Appsmith versions where the command enum was renamed or removed.

Related errors


AI-assisted analysis of appsmithorg/appsmith@8cd9021c24 (2026-08-12). Data as JSON: /api/errors/b11e61978a984176. Report an issue: GitHub.