{"record":{"id":"e9940625ab5687b0","repo":"OtterMind/Chat2DB","slug":"jsonfile-parse-error","errorCode":"jsonFile.parse.error","errorMessage":"jsonFile.parse.error","messagePattern":"jsonFile\\.parse\\.error","errorType":"exception","errorClass":"BusinessException","httpStatus":null,"severity":"warning","filePath":"chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/task/imports/json/JSONImporter.java","lineNumber":104,"sourceCode":"            if (Objects.isNull(columnValueNode)) {\n                values.add(null);\n            } else {\n                SQLDataValue sqlDataValue = getSQLDataValue(columnValueNode.asText(), c);\n                String value = valueProcessor.getSqlValueString(sqlDataValue);\n                values.add(value);\n            }\n        }\n        return values;\n    }\n\n\n    @NotNull\n    private JsonNode getJsonNode(String rootNodeName, JsonNode jsonNode) {\n        if (StringUtils.isNotBlank(rootNodeName) && jsonNode.has(rootNodeName)) {\n            jsonNode = jsonNode.get(rootNodeName);\n        }\n        if (!jsonNode.isArray() || jsonNode.size() <= 0) {\n            throw new BusinessException(\"jsonFile.parse.error\");\n        }\n        return jsonNode;\n    }\n\n}\n","sourceCodeStart":86,"sourceCodeEnd":110,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/task/imports/json/JSONImporter.java#L86-L110","documentation":"BusinessException 'jsonFile.parse.error' from JSONImporter.getJsonNode when, after optional rootNodeName resolution, the target JsonNode is not an array or is an empty array. The importer expects the JSON content (or the named root) to be a non-empty array of row objects.","triggerScenarios":"Importing a JSON file whose root (or named root node) is an object, a scalar, or an empty array; rootNodeName points at a non-array child; file is a JSON object wrapper without the rows array.","commonSituations":"File exported as a single object instead of array; empty file/array; wrong rootNodeName configured; JSON structure differs from the expected [{...},{...}] shape.","solutions":["Ensure the JSON file (or the configured root node) is a non-empty array of row objects, e.g. [{...},{...}].","Set the correct rootNodeName if rows are nested under a key (e.g. {\"data\":[...]} -> rootNodeName='data').","Remove empty leading/trailing array entries and confirm the file is not truncated."],"exampleFix":"// before\n{\"count\":2}            // not an array -> throws\n// after\n[{\"id\":1},{\"id\":2}]     // non-empty array of rows\n","handlingStrategy":"validation","validationCode":"JsonNode node = rootNodeName != null && root.has(rootNodeName) ? root.get(rootNodeName) : root;\nif (!node.isArray() || node.size() == 0) throw new BusinessException(\"jsonFile.parse.error\");","typeGuard":"boolean isNonEmptyArrayNode(com.fasterxml.jackson.databind.JsonNode n) {\n    return n != null && n.isArray() && n.size() > 0;\n}","tryCatchPattern":null,"preventionTips":["Produce/expect JSON as a non-empty array of row objects.","Set the correct rootNodeName when rows are nested under a key.","Reject empty or object-shaped JSON before import."],"tags":["import","json","validation","parsing"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}