{"record":{"id":"2062151dd0aa2062","repo":"apache/seatunnel","slug":"illegal-argument-206215","errorCode":"ILLEGAL_ARGUMENT","errorMessage":"Key Type of MapType must String type","messagePattern":"Key Type of MapType must String type","errorType":"error_code","errorClass":"Neo4jConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-neo4j/src/main/java/org/apache/seatunnel/connectors/seatunnel/neo4j/source/Neo4jSourceReader.java","lineNumber":205,"sourceCode":"            case BOOLEAN:\n                return value.asBoolean();\n            case BIGINT:\n                return value.asLong();\n            case DOUBLE:\n                return value.asDouble();\n            case NULL:\n                return null;\n            case BYTES:\n                return value.asByteArray();\n            case DATE:\n                return value.asLocalDate();\n            case TIME:\n                return value.asLocalTime();\n            case TIMESTAMP:\n                return value.asLocalDateTime();\n            case MAP:\n                if (!((MapType<?, ?>) dataType).getKeyType().equals(BasicType.STRING_TYPE)) {\n                    throw new Neo4jConnectorException(\n                            CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT,\n                            \"Key Type of MapType must String type\");\n                }\n                final SeaTunnelDataType<?> valueType = ((MapType<?, ?>) dataType).getValueType();\n                return value.asMap(v -> valueType.getTypeClass().cast(convertType(valueType, v)));\n            case ARRAY:\n                final SeaTunnelDataType<?> elementType =\n                        ((ArrayType<?, ?>) dataType).getElementType();\n                final List<?> list =\n                        value.asList(\n                                v -> elementType.getTypeClass().cast(convertType(elementType, v)));\n                final Object array = Array.newInstance(elementType.getTypeClass(), list.size());\n                for (int i = 0; i < list.size(); i++) {\n                    Array.set(array, i, list.get(i));\n                }\n                return array;\n            case INT:\n                return value.asInt();","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-neo4j/src/main/java/org/apache/seatunnel/connectors/seatunnel/neo4j/source/Neo4jSourceReader.java#L187-L223","documentation":"The Neo4j reader can only convert MAP-typed SeaTunnel columns whose key type is STRING, since Neo4j returns property maps keyed by String. convertType throws Neo4jConnectorException (ILLEGAL_ARGUMENT) when a schema declares a map with a non-String key type.","triggerScenarios":"convertType (called from convertRecord, recursively from convertType, or list) encounters a MapType whose getKeyType() != BasicType.STRING_TYPE while converting a Neo4j Value.","commonSituations":"Users declare a schema column as map<int,int> or map<string->other> in the Neo4j source schema, but Neo4j property maps are always string-keyed; schema copied from another connector supporting arbitrary key types.","solutions":["Change the schema column type to map<string, T> so the key type is STRING.","Flatten the map into individual columns in the Cypher query (e.g. RETURN m.key1 AS key1).","If non-string keys are essential, cast keys to string in Cypher (toString(k)) and use map<string,T>."],"exampleFix":"// before\ncolumns = [{ name = props, type = map<int, string> }]\n// after\ncolumns = [{ name = props, type = map<string, string> }]","handlingStrategy":"validation","validationCode":"columns.forEach(c -> {\n  if (c.type.startsWith(\"map<\") && !c.type.toLowerCase().startsWith(\"map<string\")) {\n    throw new IllegalArgumentException(\"Neo4j map keys must be string: \" + c.name);\n  }\n});","typeGuard":"static boolean hasStringMapKey(SeaTunnelDataType<?> t) {\n  return !(t instanceof MapType) || ((MapType<?, ?>) t).getKeyType().equals(BasicType.STRING_TYPE);\n}","tryCatchPattern":"try {\n  row = convertRecord(...);\n} catch (Neo4jConnectorException e) {\n  if (\"ILLEGAL_ARGUMENT\".equals(e.getSeaTunnelErrorCode().getCode())) {\n    // fix schema: use map<string, T>\n  }\n  throw e;\n}","preventionTips":["Declare all map columns as map<string, T> in Neo4j source schemas.","Remember Neo4j property maps are inherently string-keyed.","Extract non-string-keyed structures as separate columns via Cypher."],"tags":["neo4j","type-mismatch","map-type","schema"],"backgroundTag":"type-mismatch","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"}