{"record":{"id":"c3701bf9659fd9d7","repo":"apache/seatunnel","slug":"expected-list-type-but-got","errorCode":null,"errorMessage":"Expected List type but got: ","messagePattern":"Expected List type but got: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-aerospike/src/main/java/org/apache/seatunnel/connectors/seatunnel/aerospike/sink/AerospikeSinkWriter.java","lineNumber":218,"sourceCode":"                    return ((Number) value).doubleValue();\n                }\n                return Double.parseDouble(value.toString());\n            case BOOLEAN:\n                if (value instanceof Boolean) {\n                    return value;\n                }\n                return Boolean.parseBoolean(value.toString());\n            case BYTEARRAY:\n                if (value.getClass().isArray()) {\n                    return value;\n                }\n                throw new IllegalArgumentException(\n                        \"Expected Array type but got: \" + value.getClass());\n            case LIST:\n                if (value instanceof Iterable) {\n                    return value;\n                }\n                throw new IllegalArgumentException(\n                        \"Expected List type but got: \" + value.getClass());\n            default:\n                throw new IllegalArgumentException(\"Unsupported AEROSPIKE data type: \" + dataType);\n        }\n    }\n\n    private long parseDateTimeString(String datetime) {\n        try {\n            return LocalDateTime.parse(datetime)\n                    .atZone(ZoneId.systemDefault())\n                    .toInstant()\n                    .toEpochMilli();\n        } catch (DateTimeParseException e) {\n            try {\n                return Instant.parse(datetime).toEpochMilli();\n            } catch (DateTimeParseException ex) {\n                throw new IllegalArgumentException(\"Unsupported datetime format: \" + datetime);\n            }","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-aerospike/src/main/java/org/apache/seatunnel/connectors/seatunnel/aerospike/sink/AerospikeSinkWriter.java#L200-L236","documentation":"AerospikeSinkWriter.convertValue requires that fields configured as Aerospike LIST type implement Iterable; otherwise it throws IllegalArgumentException 'Expected List type but got: <class>'. The check guarantees the value can be stored as an Aerospike list without additional conversion.","triggerScenarios":"A record field configured with AEROSPIKE data type LIST contains an object that is not an Iterable (e.g. a String, byte[], or Map-as-array edge cases) when write() invokes convertValue.","commonSituations":"Source emits arrays as Object[] or JSON strings instead of List; schema mismatch between upstream connector array representation and sink LIST expectation; type declared LIST while data is scalar.","solutions":["Fix the sink field's AEROSPIKE type to match the actual incoming type","Use a transform (or source schema change) so the field is delivered as a List/Iterable","Unwrap JSON strings into arrays upstream before the sink","Read value.getClass() in the message to see the real type delivered"],"exampleFix":"// before\nfield { name = tags type = { data_type = LIST } } // upstream sends Object[]\n// after: wrap upstream\nObject[] raw = ...;\nList<Object> tags = Arrays.asList(raw); // deliver Iterable","handlingStrategy":"type-guard","validationCode":"Object v = row.getField(idx);\nif (!(v instanceof Iterable)) throw new IllegalArgumentException(\"field 'tags' must be Iterable for LIST, got \" + v.getClass());","typeGuard":"boolean isIterable(Object v) { return v instanceof Iterable; }","tryCatchPattern":"try { writer.write(row); } catch (AerospikeConnectorException e) { if (e.getCause() instanceof IllegalArgumentException && e.getCause().getMessage().startsWith(\"Expected List type\")) { /* convert to List upstream */ } }","preventionTips":["Ensure upstream arrays are materialized as List, not raw arrays or JSON strings","Use a transform to wrap Object[] via Arrays.asList before the sink","Validate sample records against configured AEROSPIKE types before production runs","Keep source and sink schema definitions in sync"],"tags":["aerospike","type-mismatch","list","sink"],"backgroundTag":"type-mismatch","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"}