{"record":{"id":"843ccb8b2af88b54","repo":"neondatabase/neon","slug":"unsupported-integer-size-d","errorCode":null,"errorMessage":"unsupported integer size %d\n","messagePattern":"unsupported integer size (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pgxn/neon/walproposer_compat.c","lineNumber":63,"sourceCode":"\tuint16\t\tn16;\n\tuint32\t\tn32;\n\n\tswitch (b)\n\t{\n\t\tcase 1:\n\t\t\tpq_copymsgbytes(msg, (char *) &n8, 1);\n\t\t\tresult = n8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tpq_copymsgbytes(msg, (char *) &n16, 2);\n\t\t\tresult = pg_ntoh16(n16);\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tpq_copymsgbytes(msg, (char *) &n32, 4);\n\t\t\tresult = pg_ntoh32(n32);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfprintf(stderr, \"unsupported integer size %d\\n\", b);\n\t\t\tExceptionalCondition(\"unsupported integer size\", __FILE__, __LINE__);\n\t\t\tresult = 0;\t\t\t/* keep compiler quiet */\n\t\t\tbreak;\n\t}\n\treturn result;\n}\n\n/* --------------------------------\n *\t\tpq_getmsgint64\t- get a binary 8-byte int from a message buffer\n *\n * It is tempting to merge this with pq_getmsgint, but we'd have to make the\n * result int64 for all data widths --- that could be a big performance\n * hit on machines where int64 isn't efficient.\n * --------------------------------\n */\nint64\npq_getmsgint64(StringInfo msg)\n{","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/neondatabase/neon/blob/8f60b04da47ffefe0e52bda2440134b42874eb75/pgxn/neon/walproposer_compat.c#L45-L81","documentation":"pq_getmsgint in the walproposer compat layer decodes network-order integers of exactly 1, 2, or 4 bytes. Any other width hits the default arm, prints this message, and calls ExceptionalCondition, which exits the process. 8-byte values must use pq_getmsgint64 instead.","triggerScenarios":"Protocol decode code calling pq_getmsgint with a width outside {1,2,4}: a local patch routing 8-byte fields through the wrong function, a corrupted length prefix, or memory corruption desynchronizing the message cursor.","commonSituations":"Extending the walproposer message protocol with 64-bit fields without using pq_getmsgint64; builds where struct field widths changed across versions.","solutions":["Use pq_getmsgint64 for 8-byte values in any modified decode path","Inspect the caller at the reported file:line for a computed or hardcoded width outside {1,2,4}","If unmodified code hits this, suspect corruption or version mismatch and collect logs and core dumps for a bug report"],"exampleFix":"/* before */\nresult = pq_getmsgint(msg, 8);\n/* after */\nresult = pq_getmsgint64(msg);","handlingStrategy":"validation","validationCode":"/* guard widths before decoding */\nif (b != 1 && b != 2 && b != 4) {\n    elog(ERROR, \"refusing to decode integer of width %d\", b);\n    return -1;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Route 64-bit fields through pq_getmsgint64 only","Unit-test decode paths for every message type and width","Keep encoder and decoder width tables in one place","Version-lock peers so message formats agree"],"tags":["walproposer","protocol","decode","assertion","c"],"backgroundTag":"protocol-decode-error","analyzedSha":"8f60b04da47ffefe0e52bda2440134b42874eb75","analyzedAt":"2026-08-16T23:39:28.135Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}