{"record":{"id":"d951b4685cad7c25","repo":"apache/seatunnel","slug":"jsonpath-array-cannot-be-null-or-empty","errorCode":null,"errorMessage":"JsonPath array cannot be null or empty","messagePattern":"JsonPath array cannot be null or empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/util/JsonPathProcessorFactory.java","lineNumber":80,"sourceCode":"                return matcher.createProcessor();\n            }\n        }\n\n        // Default to JsonPathProcessorImpl if no other processor matches\n        return new JsonPathProcessorImpl();\n    }\n\n    /**\n     * Get the appropriate processor for an array of JsonPaths with jsonFiledMissedReturnNull flag.\n     *\n     * @param paths Array of JsonPath objects\n     * @param jsonFiledMissedReturnNull Whether to return null for missing fields\n     * @return The appropriate JsonPathProcessor\n     */\n    public static JsonPathProcessor getProcessor(\n            JsonPath[] paths, boolean jsonFiledMissedReturnNull) {\n        if (paths == null || paths.length == 0) {\n            throw new IllegalArgumentException(\"JsonPath array cannot be null or empty\");\n        }\n\n        JsonPathProcessor processor = getProcessor(paths[0]);\n\n        // If this processor is a JsonPathProcessorImpl and jsonFiledMissedReturnNull is true,\n        // we need to set the flag\n        if (processor instanceof JsonPathProcessorImpl && jsonFiledMissedReturnNull) {\n            ((JsonPathProcessorImpl) processor).setJsonFiledMissedReturnNull(true);\n        }\n\n        return processor;\n    }\n\n    /** Helper class to match and create JsonPathProcessors. */\n    private static class ProcessorMatcher {\n        private final PathMatcher matcher;\n        private final Supplier<JsonPathProcessor> processorSupplier;\n","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/util/JsonPathProcessorFactory.java#L62-L98","documentation":"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.","triggerScenarios":"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.","commonSituations":"HTTP source started without json_field (schema-less mode incompatibility), or upstream code constructing the paths array incorrectly after an empty JsonField.","solutions":["Provide a non-empty json_field configuration with at least one path","Check upstream code so createJsonPaths results are validated before calling getProcessor","Only use schema-less mode where json_field is legitimately omitted and the factory is not invoked"],"exampleFix":"// before\ngetProcessor(new JsonPath[0], false)\n// after\nif (paths == null || paths.length == 0) return defaultProcessor;\ngetProcessor(paths, false)","handlingStrategy":"validation","validationCode":"if (jsonField == null || jsonField.getFields() == null || jsonField.getFields().isEmpty()) { skipProcessorSelection(); }","typeGuard":null,"tryCatchPattern":"try { processor = JsonPathProcessorFactory.getProcessor(paths, false); } catch (IllegalArgumentException e) { log.error(\"json_field missing or empty in source config\", e); throw e; }","preventionTips":["Always configure json_field when using JsonPath-based parsing","Validate the source config before job submission","Guard factory calls with an empty-paths check"],"tags":["jsonpath","argument-validation","config"],"backgroundTag":"missing-required-argument","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}