{"record":{"id":"b11e61978a984176","repo":"appsmithorg/appsmith","slug":"unexpected-value-command","errorCode":null,"errorMessage":"Unexpected value: {command}","messagePattern":"Unexpected value: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"app/server/appsmith-plugins/awsLambdaPlugin/src/main/java/com/external/plugins/AwsLambdaPlugin.java","lineNumber":82,"sourceCode":"                DatasourceConfiguration datasourceConfiguration,\n                ActionConfiguration actionConfiguration) {\n\n            log.debug(Thread.currentThread().getName() + \": execute() called for AWS Lambda plugin.\");\n            Map<String, Object> formData = actionConfiguration.getFormData();\n            String command = getDataValueSafelyFromFormData(formData, \"command\", STRING_TYPE);\n\n            return Mono.fromCallable(() -> {\n                        log.debug(Thread.currentThread().getName()\n                                + \": creating action execution result for AWS Lambda plugin.\");\n                        ActionExecutionResult result;\n                        switch (Objects.requireNonNull(command)) {\n                            case \"LIST_FUNCTIONS\" -> result = listFunctions(actionConfiguration, connection);\n                            case \"LIST_FUNCTION_VERSIONS\" ->\n                                result = listFunctionVersions(actionConfiguration, connection);\n                            case \"LIST_FUNCTION_ALIASES\" ->\n                                result = listFunctionAliases(actionConfiguration, connection);\n                            case \"INVOKE_FUNCTION\" -> result = invokeFunction(actionConfiguration, connection);\n                            default -> throw new IllegalStateException(\"Unexpected value: \" + command);\n                        }\n\n                        return result;\n                    })\n                    .onErrorMap(\n                            IllegalArgumentException.class,\n                            e -> new AppsmithPluginException(\n                                    AppsmithPluginError.PLUGIN_ERROR, \"Unsupported command: \" + command))\n                    .onErrorMap(\n                            ResourceNotFoundException.class,\n                            e -> new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, e.getErrorMessage()))\n                    .onErrorMap(\n                            Exception.class,\n                            e -> new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, e.getMessage()))\n                    .map(obj -> obj)\n                    .subscribeOn(Schedulers.boundedElastic());\n        }\n","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/appsmithorg/appsmith/blob/8cd9021c24cdbea1c3c12c966073708e83db60c2/app/server/appsmith-plugins/awsLambdaPlugin/src/main/java/com/external/plugins/AwsLambdaPlugin.java#L64-L100","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","If the action was imported or migrated, re-select the command from the dropdown so valid form data is rewritten.","Ensure the deployed plugin JAR version matches the editor's plugin specification — redeploy or update the plugin.","If calling execute() programmatically, validate the command string against the known set before invoking."],"exampleFix":"// before — invalid command in form data\nMap<String, Object> formData = Map.of(\"command\", \"DELETE_FUNCTION\");\n\n// after — valid command\nMap<String, Object> formData = Map.of(\"command\", \"INVOKE_FUNCTION\");","handlingStrategy":"validation","validationCode":"private static final Set<String> VALID_COMMANDS = Set.of(\n    \"LIST_FUNCTIONS\", \"LIST_FUNCTION_VERSIONS\",\n    \"LIST_FUNCTION_ALIASES\", \"INVOKE_FUNCTION\");\n\nString command = getDataValueSafelyFromFormData(form.getFormData(), \"command\", STRING_TYPE);\nif (!VALID_COMMANDS.contains(command)) {\n    throw new IllegalArgumentException(\n        \"Invalid AWS Lambda command: \" + command + \". Expected one of \" + VALID_COMMANDS);\n}","typeGuard":null,"tryCatchPattern":"// In a Reactor pipeline calling plugin.execute():\n.execute()\n.onErrorMap(IllegalStateException.class,\n    e -> new AppsmithPluginException(\n        AppsmithPluginError.PLUGIN_ERROR,\n        \"Unknown AWS Lambda command. Valid: LIST_FUNCTIONS, LIST_FUNCTION_VERSIONS, LIST_FUNCTION_ALIASES, INVOKE_FUNCTION\"))\n.onErrorResume(AppsmithPluginException.class, e -> Mono.just(errorResult(e)));","preventionTips":["Validate the command string against the four known constants before calling execute().","Keep the editor plugin spec and the deployed plugin JAR on the same version.","After importing or migrating an action, re-select the command from the dropdown to rewrite valid form data."],"tags":["aws-lambda","command-validation","switch-default","plugin-contract"],"backgroundTag":null,"analyzedSha":"8cd9021c24cdbea1c3c12c966073708e83db60c2","analyzedAt":"2026-08-12T22:14:19.293Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}