neondatabase/neon · critical

unsupported integer size %d

Error message

unsupported integer size %d

What it means

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.

Source

Thrown at pgxn/neon/walproposer_compat.c:63

	uint16		n16;
	uint32		n32;

	switch (b)
	{
		case 1:
			pq_copymsgbytes(msg, (char *) &n8, 1);
			result = n8;
			break;
		case 2:
			pq_copymsgbytes(msg, (char *) &n16, 2);
			result = pg_ntoh16(n16);
			break;
		case 4:
			pq_copymsgbytes(msg, (char *) &n32, 4);
			result = pg_ntoh32(n32);
			break;
		default:
			fprintf(stderr, "unsupported integer size %d\n", b);
			ExceptionalCondition("unsupported integer size", __FILE__, __LINE__);
			result = 0;			/* keep compiler quiet */
			break;
	}
	return result;
}

/* --------------------------------
 *		pq_getmsgint64	- get a binary 8-byte int from a message buffer
 *
 * It is tempting to merge this with pq_getmsgint, but we'd have to make the
 * result int64 for all data widths --- that could be a big performance
 * hit on machines where int64 isn't efficient.
 * --------------------------------
 */
int64
pq_getmsgint64(StringInfo msg)
{

View on GitHub (pinned to 8f60b04da4)

Solutions

  1. Use pq_getmsgint64 for 8-byte values in any modified decode path
  2. Inspect the caller at the reported file:line for a computed or hardcoded width outside {1,2,4}
  3. If unmodified code hits this, suspect corruption or version mismatch and collect logs and core dumps for a bug report

Example fix

/* before */
result = pq_getmsgint(msg, 8);
/* after */
result = pq_getmsgint64(msg);
Defensive patterns

Strategy: validation

Validate before calling

/* guard widths before decoding */
if (b != 1 && b != 2 && b != 4) {
    elog(ERROR, "refusing to decode integer of width %d", b);
    return -1;
}

Prevention

When it happens

Trigger: 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.

Common situations: Extending the walproposer message protocol with 64-bit fields without using pq_getmsgint64; builds where struct field widths changed across versions.

Related errors


AI-assisted analysis of neondatabase/neon@8f60b04da4 (2026-08-16). Data as JSON: /api/errors/843ccb8b2af88b54. Report an issue: GitHub.