{"record":{"id":"5787a23bc010ec67","repo":"apache/seatunnel","slug":"connection-failed-5787a2","errorCode":"CONNECTION_FAILED","errorMessage":"Failed to initialize SNMP client for agent {host}:{port}","messagePattern":"Failed to initialize SNMP client for agent (.+?):(.+?)","errorType":"error_code","errorClass":"SnmpConnectorException","httpStatus":null,"severity":"critical","filePath":"seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/source/SnmpSourceReader.java","lineNumber":77,"sourceCode":"            SnmpClientFactory clientFactory,\n            LongSupplier currentTimeMillis) {\n        this.config = config;\n        this.context = context;\n        this.clientFactory = clientFactory;\n        this.currentTimeMillis = currentTimeMillis;\n    }\n\n    @Override\n    public void open() {\n        try {\n            client = clientFactory.create(config);\n            LOG.info(\n                    \"SNMP source reader opened for agent [{}:{}] with [{}] OIDs\",\n                    config.getHost(),\n                    config.getPort(),\n                    config.getOids().size());\n        } catch (IOException e) {\n            throw new SnmpConnectorException(\n                    SnmpConnectorErrorCode.CONNECTION_FAILED,\n                    \"Failed to initialize SNMP client for agent \"\n                            + config.getHost()\n                            + \":\"\n                            + config.getPort(),\n                    e);\n        }\n    }\n\n    @Override\n    public void pollNext(Collector<SeaTunnelRow> output) throws Exception {\n        if (closed || noMoreSplits) {\n            return;\n        }\n\n        if (Boundedness.UNBOUNDED.equals(context.getBoundedness())) {\n            long waitMillis = nextPollTimeMillis - currentTimeMillis.getAsLong();\n            if (waitMillis > 0) {","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/source/SnmpSourceReader.java#L59-L95","documentation":"SnmpSourceReader.open() initializes the SNMP client for polling. If client setup throws IOException, the reader rethrows it as SnmpConnectorException with CONNECTION_FAILED after logging that open failed. The source task cannot start reading from this agent.","triggerScenarios":"Calling open() on SnmpSourceReader when Snmp4jClient construction/initialization (SNMP4J session/transport setup for host:port) throws IOException.","commonSituations":"Unresolvable hostname or wrong port in source config; invalid SNMP version/community in config; SNMPv3 USM/engine-discovery failure; worker host lacking network access or UDP sockets.","solutions":["Validate the source config: host resolves from the worker, port correct (161), SNMP version supported.","Check community string and SNMPv3 USM credentials before submitting the job.","Read the wrapped IOException cause for the exact transport error.","Test connectivity from the SeaTunnel worker node (not just the client machine).","Review SnmpSourceConfig validation and fix any out-of-range timeout/retry values."],"exampleFix":"// before\n{ \"host\": \"localhost\", \"port\": 1610 }\n// after\n{ \"host\": \"localhost\", \"port\": 161 }","handlingStrategy":"validation","validationCode":"// fail fast before submitting the job\nObjects.requireNonNull(config.getHost(), \"host required\");\nif (config.getPort() < 1 || config.getPort() > 65535) throw new IllegalArgumentException(\"invalid port\");\nInetAddress.getByName(config.getHost());","typeGuard":null,"tryCatchPattern":"try {\n    reader.open();\n} catch (SnmpConnectorException e) {\n    if (e.getCode() == SnmpConnectorErrorCode.CONNECTION_FAILED)\n        LOG.error(\"SNMP source init failed for {}:{}\", config.getHost(), config.getPort(), e.getCause());\n    throw e;\n}","preventionTips":["Validate host/port/version/community in the source config at submission time.","Run a pre-flight snmpget from each worker node.","Check the wrapped IOException cause for DNS vs transport failures.","Pin SNMPv3 USM credentials in config management to avoid init-time discovery failures."],"tags":["snmp","initialization","connection","source"],"backgroundTag":"module-init-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}