{"record":{"id":"ce4b5013d28a40a0","repo":"apache/seatunnel","slug":"snmp-agent-returned-error-status-errorstatus-e","errorCode":null,"errorMessage":"SNMP agent returned error status {errorStatus} ({errorStatusText}) at index {errorIndex}","messagePattern":"SNMP agent returned error status (.+?) \\((.+?)\\) at index (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/sink/Snmp4jSetClient.java","lineNumber":74,"sourceCode":"        }\n        this.target = createdTarget;\n        this.snmp = snmp;\n    }\n\n    @Override\n    public void set(SnmpSetRequest request) throws IOException {\n        ResponseEvent event = snmp.send(buildSetRequest(request), target);\n        if (event == null || event.getResponse() == null) {\n            throw new IOException(\n                    \"SNMP SET request timed out for agent \"\n                            + config.getHost()\n                            + \":\"\n                            + config.getPort());\n        }\n\n        PDU response = event.getResponse();\n        if (response.getErrorStatus() != PDU.noError) {\n            throw new IOException(\n                    \"SNMP agent returned error status \"\n                            + response.getErrorStatus()\n                            + \" (\"\n                            + response.getErrorStatusText()\n                            + \") at index \"\n                            + response.getErrorIndex());\n        }\n    }\n\n    @Override\n    public void close() throws IOException {\n        snmp.close();\n    }\n\n    static PDU buildSetRequest(SnmpSetRequest request) {\n        PDU pdu = new PDU();\n        pdu.setType(PDU.SET);\n        pdu.add(new VariableBinding(request.getOid(), request.getValue()));","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/sink/Snmp4jSetClient.java#L56-L92","documentation":"After a SET exchange completes, Snmp4jSetClient.set() inspects the response PDU's errorStatus. If it is not PDU.noError, the agent explicitly rejected the SET and the client wraps the agent's status code, status text, and error index into this IOException. Unlike a timeout, the agent was reachable but refused the operation.","triggerScenarios":"Calling Snmp4jSetClient.set(SnmpSetRequest) where the response PDU has getErrorStatus() != PDU.noError (e.g. noSuchName, badValue, genErr, authorizationError), with errorIndex pointing at the offending varbind.","commonSituations":"Writing to a read-only OID; OID does not exist on the agent (noSuchName); wrong value type/syntax for the OID (badValue); SET with a read-only community (authorizationError); variable bindings built from mismatched SeaTunnel row columns.","solutions":["Read errorStatusText and errorIndex from the message to identify which OID varbind was rejected.","Confirm the target OID is writable on the agent (not read-only) and exists in the agent's MIB view.","Match the value's ASN.1 type/syntax to the OID's MIB definition (SnmpSinkRowConverter output).","Use a read-write community or SNMPv3 user with write access for SET operations.","Test the same SET manually with snmpset to reproduce the agent's rejection outside SeaTunnel."],"exampleFix":"// before\nrequest OID: 1.3.6.1.2.1.1.4.0 (sysContact) with community \"public\" (read-only)\n// after\nuse rw-community \"private\" or SNMPv3 user with write privilege for sysContact","handlingStrategy":"validation","validationCode":"// validate the OID is writable and present before the job\nString out = snmpCli(\"snmpget -v2c -c \" + community + \" \" + host + \" \" + oid);\nif (out.contains(\"No Such Instance\")) throw new IllegalArgumentException(\"OID not on agent: \" + oid);\n// check MIB definition marks MAX-ACCESS as read-write/read-create","typeGuard":null,"tryCatchPattern":"try {\n    client.set(request);\n} catch (IOException e) {\n    PduError pe = parseAgentError(e);\n    if (pe != null) throw new InvalidOidMappingException(pe.status, pe.index, request.getOid());\n    throw e;\n}","preventionTips":["Cross-check every configured OID against the agent's MIB (snmpwalk) before running.","Match column types to OID ASN.1 syntax when defining row-to-OID mappings.","Use SNMPv2c/v3 for clearer noSuchInstance/noSuchObject semantics.","Test each SET with the snmpset CLI in a staging environment first."],"tags":["snmp","agent-error","write","sink"],"backgroundTag":"api-error-response","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"}