{"record":{"id":"5a313ec44a105148","repo":"apache/seatunnel","slug":"common-02-5a313e","errorCode":"COMMON-02","errorMessage":"<identifier> JSON convert/parse '<payload>' operation failed.","messagePattern":"<identifier> JSON convert/parse '<payload>' operation failed\\.","errorType":"error_code","errorClass":"org.apache.seatunnel.common.exception.SeaTunnelRuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-fake/src/main/java/org/apache/seatunnel/connectors/seatunnel/fake/source/FakeDataGenerator.java","lineNumber":94,"sourceCode":"        this.fakeConfig = fakeConfig;\n        this.jsonDeserializationSchema =\n                fakeConfig.getFakeRows() == null\n                        ? null\n                        : new JsonDeserializationSchema(catalogTable, false, false);\n        this.fakeDataRandomUtils = new FakeDataRandomUtils(fakeConfig, jobId);\n    }\n\n    private SeaTunnelRow convertRow(FakeConfig.RowData rowData) {\n        try {\n            SeaTunnelRow seaTunnelRow =\n                    jsonDeserializationSchema.deserialize(rowData.getFieldsJson());\n            if (rowData.getKind() != null) {\n                seaTunnelRow.setRowKind(RowKind.valueOf(rowData.getKind()));\n            }\n            seaTunnelRow.setTableId(tableId);\n            return seaTunnelRow;\n        } catch (IOException e) {\n            throw CommonError.jsonOperationError(\"Fake\", rowData.getFieldsJson(), e);\n        }\n    }\n\n    private SeaTunnelRow randomRow() {\n        // Generate random data according to the data type and data colum of the table\n        List<Column> physicalColumns = catalogTable.getTableSchema().getColumns();\n        List<Object> randomRow = new ArrayList<>(physicalColumns.size());\n        for (Column column : physicalColumns) {\n            randomRow.add(randomColumnValue(column));\n        }\n        SeaTunnelRow seaTunnelRow = new SeaTunnelRow(randomRow.toArray());\n        seaTunnelRow.setTableId(tableId);\n        return seaTunnelRow;\n    }\n\n    @VisibleForTesting\n    public List<SeaTunnelRow> generateFakedRows(int rowNum) {\n        List<SeaTunnelRow> rows = new ArrayList<>();","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-fake/src/main/java/org/apache/seatunnel/connectors/seatunnel/fake/source/FakeDataGenerator.java#L76-L112","documentation":"The Fake source connector wraps any failure while deserializing a user-provided 'fake.rows' JSON payload into a SeaTunnelRow with this generic JSON convert/parse error (code COMMON-02), built by CommonError.jsonOperationError. It is thrown from FakeDataGenerator.convertRow when JsonDeserializationSchema.deserialize throws an IOException. This typically means the JSON in fake.rows does not match the table schema declared in the catalog table, or the JSON itself is malformed.","triggerScenarios":"Thrown in FakeDataGenerator.convertRow (FakeDataGenerator.java:94) when jsonDeserializationSchema.deserialize(rowData.getFieldsJson()) raises IOException, i.e. the fieldsJson string cannot be parsed as JSON or does not conform to the CatalogTable's row type. Called via generateCustomRows whenever the Fake source config contains custom 'fake.rows'.","commonSituations":"1) A malformed JSON literal in fake.rows (missing quotes, trailing comma, unescaped characters). 2) fake.rows fields not matching the declared schema (wrong column names, wrong types such as a string where an int is expected). 3) fieldsJson being null or empty because the config assembled RowData incorrectly. 4) Nested/complex types (arrays, maps, rows) whose JSON shape doesn't match the catalog table definition.","solutions":["Print and validate the failing payload shown in the message ('<payload>') with a JSON linter to fix syntax errors.","Compare the JSON keys and value types in fake.rows against the columns declared in the table schema; rename keys and coerce types so they match exactly.","If the payload is generated programmatically, ensure fieldsJson is serialized with a proper JSON serializer and is non-null/non-empty.","For complex column types, make sure nested JSON structure (array/map/row) matches the SeaTunnel data type definition."],"exampleFix":"// before (HOCON fake source config)\nFake {\n  rows = [\n    { kind = INSERT, fields = {name = \"a\", age = \"x\"} }  // age declared INTEGER\n  ]\n}\n// after\nFake {\n  rows = [\n    { kind = INSERT, fields = {name = \"a\", age = 30} }\n  ]\n}","handlingStrategy":"validation","validationCode":"// Validate the fake.rows JSON before starting the job\nfor (FakeConfig.RowData row : fakeConfig.getFakeRows()) {\n    String json = row.getFieldsJson();\n    if (json == null || json.trim().isEmpty()) {\n        throw new IllegalArgumentException(\"fake.rows entry has empty fieldsJson\");\n    }\n    try (java.io.Reader r = new java.io.StringReader(json)) {\n        new com.fasterxml.jackson.databind.ObjectMapper().readTree(r); // throws on malformed JSON\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    SeaTunnelRow row = generator.convertRow(rowData);\n} catch (org.apache.seatunnel.api.table.type.CommonErrorCode | RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"JSON convert/parse\")) {\n        LOGGER.error(\"Invalid fake.rows payload: {}\", rowData.getFieldsJson(), e);\n        return; // skip or fail fast with a clear message\n    }\n    throw e;\n}","preventionTips":["Validate every fake.rows entry with a JSON parser and against the table schema before deploying the job.","Keep fake.rows field names and types exactly aligned with the declared catalog table columns.","Generate fieldsJson with a serializer rather than hand-writing JSON strings in config files.","Test the Fake source locally with -e local before running in a cluster."],"tags":["json","deserialization","fake-source","schema-mismatch"],"backgroundTag":"json-parse-error","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}