apache/seatunnel · error · IllegalArgumentException
Invalid sort JSON:
Error message
Invalid sort JSON:
What it means
AirtableSourceParameter.parseSort throws IllegalArgumentException 'Invalid sort JSON: <input>' when the 'sort' option is not valid JSON shaped as a list of objects (List<Map<String,Object>>) as Airtable's API expects. The parse exception from JsonUtils is attached as the cause.
Source
Thrown at seatunnel-connectors-v2/connector-http/connector-http-airtable/src/main/java/org/apache/seatunnel/connectors/seatunnel/airtable/source/config/AirtableSourceParameter.java:178
}
private void checkConflict(
ReadonlyConfig pluginConfig,
Map<String, Object> body,
Option<?> option,
String bodyKey,
List<String> conflicts) {
if (pluginConfig.getOptional(option).isPresent() && body.containsKey(bodyKey)) {
conflicts.add(bodyKey + " (option: " + option.key() + ")");
}
}
private Object parseSort(String sortJson) {
try {
return JsonUtils.parseObject(
sortJson, new TypeReference<List<Map<String, Object>>>() {});
} catch (RuntimeException e) {
throw new IllegalArgumentException("Invalid sort JSON: " + sortJson, e);
}
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Write valid JSON with quoted keys and double-quoted string values: sort = "[{\"field\":\"Name\",\"direction\":\"asc\"}]".
- Validate the JSON in a linter before putting it in the config.
- Ensure the top-level shape is a JSON array of objects, not a string or single object.
Example fix
// before
sort = "[{field: 'Name', direction: 'asc'}]"
// after
sort = "[{\"field\":\"Name\",\"direction\":\"asc\"}]" Defensive patterns
Strategy: validation
Validate before calling
// Validate sort JSON before submitting
try { new com.fasterxml.jackson.databind.ObjectMapper().readValue(sortJson, new TypeReference<List<Map<String,Object>>>(){}); } catch (Exception e) { throw new IllegalArgumentException("bad sort"); } Try / catch
try { createSource(config); } catch (IllegalArgumentException e) { /* message contains the offending sort string */ } Prevention
- Quote all keys and string values in the sort JSON
- Test the JSON with a linter or jq before pasting into HOCON
- Keep Airtable's sort shape: array of {field, direction} objects
When it happens
Trigger: Setting sort = "[{field: \"Name\", direction: \"asc\"}]" without quoting keys, or passing a bare string/array-formatted HOCON that fails JSON parsing when the source builds its request body.
Common situations: Hand-writing sort JSON in HOCON where keys are unquoted or values use single quotes; wrapping the array in an extra string; confusing Airtable's sort format with plain field names.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Conflict between 'body' and dedicated Airtable options for k
- Schema config can not be empty
- Unknown format type:
- AmazonDocumentDB option '' must be a valid BSON/JSON documen
- Option '${option}' cannot be blank
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/94036ddc89f0b075.
Report an issue: GitHub.