{"record":{"id":"5ba1fae0fd796a23","repo":"louislam/uptime-kuma","slug":"no-varbinds-returned-from-snmp-session-oid-mon","errorCode":null,"errorMessage":"No varbinds returned from SNMP session (OID: ${monitor.snmpOid})","messagePattern":"No varbinds returned from SNMP session \\(OID: (.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/monitor-types/snmp.js","lineNumber":53,"sourceCode":"            }\n\n            // Handle errors during session creation\n            session.on(\"error\", (error) => {\n                throw new Error(`Error creating SNMP session: ${error.message}`);\n            });\n\n            const varbinds = await new Promise((resolve, reject) => {\n                session.get([monitor.snmpOid], (error, varbinds) => {\n                    error ? reject(error) : resolve(varbinds);\n                });\n            });\n            log.debug(\n                this.name,\n                `SNMP: Received varbinds (Type: ${snmp.ObjectType[varbinds[0].type]} Value: ${varbinds[0].value})`\n            );\n\n            if (varbinds.length === 0) {\n                throw new Error(`No varbinds returned from SNMP session (OID: ${monitor.snmpOid})`);\n            }\n\n            if (varbinds[0].type === snmp.ObjectType.NoSuchInstance) {\n                throw new Error(`The SNMP query returned that no instance exists for OID ${monitor.snmpOid}`);\n            }\n\n            // We restrict querying to one OID per monitor, therefore `varbinds[0]` will always contain the value we're interested in.\n            const value = varbinds[0].value;\n\n            const { status, response } = await evaluateJsonQuery(\n                value,\n                monitor.jsonPath,\n                monitor.jsonPathOperator,\n                monitor.expectedValue\n            );\n\n            if (status) {\n                heartbeat.status = UP;","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/monitor-types/snmp.js#L35-L71","documentation":"Thrown after session.get() resolves successfully but the returned varbinds array is empty. net-snmp calls back with (null, []) in edge cases where the agent returns a GetResponse PDU carrying no variable bindings. Because the monitor queries exactly one OID, an empty varbind set is treated as an unrecoverable protocol violation rather than a value mismatch.","triggerScenarios":"Produced when the agent responds to the GetRequest with a syntactically valid PDU that contains zero varbind entries, or when a net-snmp version quirk normalizes certain error PDUs into an empty array instead of an error. Also possible if the agent is a misbehaving proxy or a non-RFC-compliant device.","commonSituations":"Querying a lightweight/buggy embedded agent (printers, PDUs, IoT firmware) that omits varbinds on certain OIDs; pointing at a port that is SNMP-speaking but answering a different community context; SNMP version mismatch (e.g. querying a v2c-only device with v1 semantics) producing truncated responses.","solutions":["Validate the OID with an external tool (snmpget) against the same host/community/version to confirm the agent returns a varbind.","Match monitor.snmpVersion to the agent's actual SNMP version (1, 2c, or 3).","If using community auth, confirm monitor.radiusPassword holds the correct community string for this monitor type.","If the agent is known to return empty responses for unsupported OIDs, choose a different, populated OID."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function validateVarbinds(varbinds, oid) {\n  if (!Array.isArray(varbinds) || varbinds.length === 0) {\n    throw new Error(`No varbinds returned from SNMP session (OID: ${oid})`);\n  }\n  return varbinds;\n}","typeGuard":"function hasVarbind(vbs) {\n  return Array.isArray(vbs) && vbs.length > 0 && typeof vbs[0].type !== \"undefined\";\n}","tryCatchPattern":"try {\n  const varbinds = await getAsync(session, monitor.snmpOid);\n  if (!hasVarbind(varbinds)) throw new Error(`No varbinds (OID: ${monitor.snmpOid})`);\n} catch (e) {\n  heartbeat.status = DOWN; heartbeat.msg = e.message;\n}","preventionTips":["Verify the OID with snmpget before configuring the monitor.","Match the SNMP version to the agent.","Treat an empty varbind set as a DOWN heartbeat rather than an unhandled throw where possible."],"tags":["snmp","net-snmp","protocol","validation"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}