appsmithorg/appsmith · error · AppsmithPluginException
PE-JSN-4000
PE-JSN-4000
Error message
Plugin failed to parse JSON "{0}" What it means
In execute(), the action body string is parsed as a JSON HashMap via objectMapper.readValue(body, HashMap.class). If parsing fails (IOException), the plugin throws PLUGIN_JSON_PARSE_ERROR (PE-JSN-4000) with the raw body and the parser's error detail. The body must be a valid JSON object representing the DynamoDB request parameters.
Source
Thrown at app/server/appsmith-plugins/dynamoPlugin/src/main/java/com/external/plugins/DynamoPlugin.java:219
final String action = actionConfiguration.getPath();
if (!StringUtils.hasLength(action)) {
throw new AppsmithPluginException(
AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR,
DynamoErrorMessages.MISSING_ACTION_NAME_ERROR_MSG);
}
requestData.put("action", action);
requestParams.add(new RequestParamDTO(ACTION_CONFIGURATION_PATH, action, null, null, null));
requestParams.add(new RequestParamDTO(ACTION_CONFIGURATION_BODY, body, null, null, null));
Map<String, Object> parameters = null;
try {
if (StringUtils.hasLength(body)) {
parameters = objectMapper.readValue(body, HashMap.class);
}
} catch (IOException e) {
final String message = "Error parsing the JSON body: " + e.getMessage();
log.warn(message, e);
throw new AppsmithPluginException(
AppsmithPluginError.PLUGIN_JSON_PARSE_ERROR, body, e.getMessage());
}
requestData.put("parameters", parameters);
final Class<?> requestClass;
try {
requestClass = Class.forName(
"software.amazon.awssdk.services.dynamodb.model." + action + "Request");
} catch (ClassNotFoundException e) {
throw new AppsmithPluginException(
DynamoPluginError.UNKNOWN_ACTION_NAME,
String.format(DynamoErrorMessages.UNKNOWN_ACTION_NAME_ERROR_MSG, action),
e.getMessage());
}
try {
final Method actionExecuteMethod = DynamoDbClient.class.getMethod(
// Convert `ListTables` to `listTables`, which is the name of the method to executeView on GitHub (pinned to 8cd9021c24)
Solutions
- Validate the body with a JSON linter before saving the action.
- Ensure mustache bindings inject valid JSON fragments — wrap string values in quotes or use JSONPath-style bindings.
- Use double quotes for all keys and string values; remove trailing commas.
- Confirm the body is a JSON object (starts with '{'), not an array or scalar.
Example fix
// before — unquoted keys, trailing comma
String body = "{ TableName: 'Music', }";
// after
String body = "{\"TableName\":\"Music\"}"; Defensive patterns
Strategy: validation
Validate before calling
String body = actionConfiguration.getBody();
if (StringUtils.hasLength(body)) {
try {
objectMapper.readTree(body); // validate parseability
} catch (IOException e) {
throw new IllegalArgumentException(
"Action body is not valid JSON: " + e.getMessage());
}
} Try / catch
plugin.execute(actionConfiguration, dsConfig)
.onErrorResume(e -> e instanceof AppsmithPluginException ape
&& "PE-JSN-4000".equals(ape.getErrorDTO().getAppErrorCode()),
e -> { log.warn("Bad JSON body", e); return Mono.just(errorResult(e)); }); Prevention
- Validate the JSON body with a linter before saving the action.
- Ensure mustache bindings inject valid JSON fragments, not raw unquoted strings.
- Confirm the body is a JSON object (starts with '{').
When it happens
Trigger: The action body contains malformed JSON — trailing commas, unquoted keys, single-quoted strings, unmatched braces, or a non-JSON value injected by a mustache binding.
Common situations: Hand-typed JSON with syntax errors; a mustache binding that injects a raw string or unquoted value into the JSON; a body that is whitespace-only or contains a JSON array instead of an object; copy-paste introducing smart quotes.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
AI-assisted analysis of appsmithorg/appsmith@8cd9021c24 (2026-08-12).
Data as JSON: /api/errors/e763994beba5125f.
Report an issue: GitHub.