apache/seatunnel · error · IllegalArgumentException

JsonPath array cannot be null or empty

Error message

JsonPath array cannot be null or empty

What it means

JsonPathProcessorFactory.getProcessor requires a non-null, non-empty JsonPath array to select a processor; an empty or null array is an IllegalArgumentException. It is a fast-fail guard before choosing between the default and array processors.

Solutions

  1. Provide a non-empty json_field configuration with at least one path
  2. Check upstream code so createJsonPaths results are validated before calling getProcessor
  3. Only use schema-less mode where json_field is legitimately omitted and the factory is not invoked

Example fix

// before
getProcessor(new JsonPath[0], false)
// after
if (paths == null || paths.length == 0) return defaultProcessor;
getProcessor(paths, false)
Defensive patterns

Strategy: validation

Validate before calling

if (jsonField == null || jsonField.getFields() == null || jsonField.getFields().isEmpty()) { skipProcessorSelection(); }

Try / catch

try { processor = JsonPathProcessorFactory.getProcessor(paths, false); } catch (IllegalArgumentException e) { log.error("json_field missing or empty in source config", e); throw e; }

Prevention

When it happens

Trigger: Calling getProcessor(null, ...) or getProcessor(new JsonPath[0], ...) — e.g. when json_field is missing/empty so no JsonPaths were built before requesting a processor.

Common situations: HTTP source started without json_field (schema-less mode incompatibility), or upstream code constructing the paths array incorrectly after an empty JsonField.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/d951b4685cad7c25. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/util/JsonPathProcessorFactory.java:80

                return matcher.createProcessor();
            }
        }

        // Default to JsonPathProcessorImpl if no other processor matches
        return new JsonPathProcessorImpl();
    }

    /**
     * Get the appropriate processor for an array of JsonPaths with jsonFiledMissedReturnNull flag.
     *
     * @param paths Array of JsonPath objects
     * @param jsonFiledMissedReturnNull Whether to return null for missing fields
     * @return The appropriate JsonPathProcessor
     */
    public static JsonPathProcessor getProcessor(
            JsonPath[] paths, boolean jsonFiledMissedReturnNull) {
        if (paths == null || paths.length == 0) {
            throw new IllegalArgumentException("JsonPath array cannot be null or empty");
        }

        JsonPathProcessor processor = getProcessor(paths[0]);

        // If this processor is a JsonPathProcessorImpl and jsonFiledMissedReturnNull is true,
        // we need to set the flag
        if (processor instanceof JsonPathProcessorImpl && jsonFiledMissedReturnNull) {
            ((JsonPathProcessorImpl) processor).setJsonFiledMissedReturnNull(true);
        }

        return processor;
    }

    /** Helper class to match and create JsonPathProcessors. */
    private static class ProcessorMatcher {
        private final PathMatcher matcher;
        private final Supplier<JsonPathProcessor> processorSupplier;

View on GitHub (pinned to cf67b549a7)