{"record":{"id":"cb3a744a7e782202","repo":"elastic/elasticsearch","slug":"could-not-convert-value-of-type-to-transport","errorCode":null,"errorMessage":"could not convert value of type [{}] to transport protocol","messagePattern":"could not convert value of type \\[(.+?)\\] to transport protocol","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/CommunityIdProcessor.java","lineNumber":511,"sourceCode":"            if (o instanceof Number number) {\n                return fromNumber(number.intValue());\n            } else if (o instanceof String protocolStr) {\n                // check if matches protocol name\n                if (Type.TRANSPORT_NAMES.containsKey(protocolStr.toLowerCase(Locale.ROOT))) {\n                    return new Transport(Type.TRANSPORT_NAMES.get(protocolStr.toLowerCase(Locale.ROOT)));\n                }\n\n                // check if convertible to protocol number\n                try {\n                    int protocolNumber = Integer.parseInt(protocolStr);\n                    return fromNumber(protocolNumber);\n                } catch (NumberFormatException e) {\n                    // fall through to IllegalArgumentException\n                }\n\n                throw new IllegalArgumentException(\"could not convert string [\" + protocolStr + \"] to transport protocol\");\n            } else {\n                throw new IllegalArgumentException(\n                    \"could not convert value of type [\" + o.getClass().getName() + \"] to transport protocol\"\n                );\n            }\n        }\n    }\n\n    public enum IcmpType {\n        EchoReply(0),\n        EchoRequest(8),\n        RouterAdvertisement(9),\n        RouterSolicitation(10),\n        TimestampRequest(13),\n        TimestampReply(14),\n        InfoRequest(15),\n        InfoReply(16),\n        AddressMaskRequest(17),\n        AddressMaskReply(18),\n        V6EchoRequest(128),","sourceCodeStart":493,"sourceCodeEnd":529,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/CommunityIdProcessor.java#L493-L529","documentation":"Transport.fromObject only accepts Number or String inputs. Any other runtime type — Boolean, List, Map, Object[] — yields this exception with the fully-qualified class name interpolated. This is a type-shape failure, not a value failure.","triggerScenarios":"network.iana_number or network.transport is a Boolean (e.g. from a mis-mapped yes/no field), a List (multi-valued field), a Map, or some custom object. Only Number and String are accepted.","commonSituations":"Field mapped as object/boolean in the index but used as protocol input; multi-valued field where the source has two transports; script processor that returned a non-scalar; CSV ingest with parsing artifacts producing arrays.","solutions":["Ensure the field holds a single scalar value (Number or String) before community_id runs.","If the field is multi-valued, pick one element (e.g. the first) or split the document upstream.","Fix the index mapping so the field is keyword/long rather than object/boolean.","Quarantine via on_failure."],"exampleFix":"// before — protocol field is a list\n//   { \"network\": { \"transport\": [\"tcp\", \"udp\"] } }\n//\n// after — single scalar value\n//   { \"network\": { \"transport\": \"tcp\" } }","handlingStrategy":"type-guard","validationCode":"boolean isScalarProtocol(Object o) {\n    return o == null || o instanceof Number || o instanceof String;\n}","typeGuard":"static boolean isScalarProtocol(Object o) {\n    return o == null || o instanceof Number || o instanceof String;\n}","tryCatchPattern":"{\n  \"community_id\": {\n    \"on_failure\": [\n      { \"set\": { \"field\": \"ingest.error\", \"value\": \"community-id-non-scalar-transport\" } },\n      { \"redirect\": { \"pipeline\": \"quarantine\" } }\n    ]\n  }\n}","preventionTips":["Map network.iana_number and network.transport as keyword/long, never object/boolean.","Resolve multi-valued transport fields to a single value before community_id.","Audit script processors that may have written non-scalar values into protocol fields."],"tags":["ingest","community-id","transport","type-mismatch"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T11:17:21.771Z"}