{"record":{"id":"b0c95d10cc51c9a8","repo":"pentaho/pentaho-kettle","slug":"null-usm","errorCode":null,"errorMessage":"Null Usm","messagePattern":"Null Usm","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/snmptrap/JobEntrySNMPTrap.java","lineNumber":469,"sourceCode":"\n        usertarget.setRetries( retry );\n        usertarget.setTimeout( timeOut );\n        usertarget.setVersion( SnmpConstants.version3 );\n        usertarget.setSecurityLevel( SecurityLevel.AUTH_PRIV );\n        usertarget.setSecurityName( new OctetString( \"MD5DES\" ) );\n\n        // Since we are using SNMPv3 we use authenticated users\n        // this is handled by the UsmUser and USM class\n\n        UsmUser uu =\n          new UsmUser(\n            new OctetString( userName ), AuthMD5.ID, new OctetString( passPhrase ), PrivDES.ID,\n            new OctetString( passPhrase ) );\n\n        USM usm = snmp.getUSM();\n\n        if ( usm == null ) {\n          throw new KettleException( \"Null Usm\" );\n        } else {\n          usm = new USM( SecurityProtocols.getInstance(), new OctetString( MPv3.createLocalEngineID() ), 0 );\n          usm.addUser( new OctetString( userName ), uu );\n          if ( log.isDebug() ) {\n            logDebug( \"Valid Usm\" );\n          }\n        }\n\n        // create the PDU\n        ScopedPDU pdu = new ScopedPDU();\n        pdu.add( new VariableBinding( new OID( Oid ), new OctetString( messageString ) ) );\n        pdu.setType( PDU.TRAP );\n        if ( !Utils.isEmpty( engineID ) ) {\n          pdu.setContextEngineID( new OctetString( engineID ) );\n        }\n\n        // send the PDU\n        response = snmp.send( pdu, usertarget );","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/snmptrap/JobEntrySNMPTrap.java#L451-L487","documentation":"In JobEntrySNMPTrap.execute for SNMPv3, after Snmp.snmpInstance/createUserEntry, snmp.getUSM() may return null; the code then throws KettleException 'Null Usm'. The SNMP4J User-based Security Model was not initialized in the SNMP session, so the v3 user cannot be registered.","triggerScenarios":"execute() with targettype=SNMPv3 when the underlying Snmp session's USM is null - typically when MPv3 engine boot/index state is inconsistent or the session was created without the security model initialized.","commonSituations":"Multiple trap sends in one JVM reusing sessions oddly; SNMP4J version behavior differences around engine ID initialization; engine ID/boots configuration issues for the local engine.","solutions":["Retry the trap send; ensure a fresh Snmp session is created per execute (the code path builds a replacement USM only when non-null path fails).","Check the SNMP4J library version and align with the one bundled/tested with this Pentaho version.","Ensure auth/priv passphrases and engine ID settings are valid lengths (MD5/DES require >=8 chars) so user creation succeeds before getUSM().","Enable debug logging on the job entry to see how far SNMP session setup progressed before the null USM."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-check SNMPv3 parameters before execute\nif (userName == null || passPhrase == null || passPhrase.length() < 8) {\n  throw new IllegalArgumentException(\"SNMPv3 user/passphrase invalid (min 8 chars)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  result = jobEntry.execute(prevResult, nr);\n} catch (KettleException e) {\n  if (\"Null Usm\".equals(e.getMessage())) {\n    logError(\"SNMP USM not initialized; check SNMP4J version/engine ID, retrying\");\n    // rebuild session and retry once\n  }\n}","preventionTips":["Use SNMPv3 passphrases of at least 8 characters (MD5/DES requirement).","Pin the SNMP4J version compatible with your Pentaho release.","Create a fresh Snmp session per send to avoid stale USM state.","Enable debug logging to trace session initialization."],"tags":["snmp","snmpv3","usm","library"],"backgroundTag":"internal-invariant-violation","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}