skylot/jadx · error · JadxRuntimeException
Unsigned byte value is too big:
Error message
Unsigned byte value is too big:
What it means
Thrown by ClsSet.writeUnsignedByte() when the value being written is negative or >= 255. This is a defensive programming check during .clst serialization. The unsigned-byte format slot can only hold values 0–254. Any caller passing a value outside that range is a bug in the writing code.
Source
Thrown at jadx-core/src/main/java/jadx/core/clsp/ClsSet.java:482
}
private static String readString(DataInputStream in, int len) throws IOException {
byte[] bytes = new byte[len];
int count = in.read(bytes);
while (count != len) {
int res = in.read(bytes, count, len - count);
if (res == -1) {
throw new IOException("String read error");
} else {
count += res;
}
}
return new String(bytes, STRING_CHARSET);
}
private static void writeUnsignedByte(DataOutputStream out, int value) throws IOException {
if (value < 0 || value >= 0xFF) {
throw new JadxRuntimeException("Unsigned byte value is too big: " + value);
}
out.writeByte(value);
}
private static int readUnsignedByte(DataInputStream in) throws IOException {
return ((int) in.readByte()) & 0xFF;
}
public int getClassesCount() {
return classes.length;
}
public void addToMap(Map<String, ClspClass> nameMap) {
for (ClspClass cls : classes) {
nameMap.put(cls.getName(), cls);
}
}
View on GitHub (pinned to e738a26571)
Solutions
- Check the caller of writeUnsignedByte — the value must be in [0, 254]. Add logging before the call to identify which field overflows.
- If the value legitimately exceeds 254, switch the encoding to a wider type (e.g., writeShort) and update the corresponding reader.
- Ensure string lengths are validated upstream in writeString before reaching this method.
Defensive patterns
Strategy: validation
Validate before calling
// If you call writeUnsignedByte directly, validate first
private static void safeWriteUnsignedByte(DataOutputStream out, int value) throws IOException {
if (value < 0 || value >= 0xFF) {
throw new IllegalArgumentException(
"Value out of unsigned-byte range [0, 254]: " + value);
}
out.writeByte(value);
} Try / catch
try {
writeUnsignedByte(out, value);
} catch (JadxRuntimeException e) {
logger.error("Value {} exceeds unsigned-byte format limit", value, e);
// Switch to wider encoding or truncate the data set
throw e;
} Prevention
- Always validate value ranges before calling writeUnsignedByte.
- Ensure string lengths and counts are pre-checked upstream.
- Log the offending value and context to diagnose which field overflows.
When it happens
Trigger: Internal programming error where a string length, type list count, or other small value exceeds the single-byte capacity. Could be triggered indirectly by writeString() if the string is exactly 255 bytes (though writeString checks >= 255 first).
Common situations: Modifying ClsSet serialization logic and accidentally passing a value >= 255 or < 0 to writeUnsignedByte. Extremely long names or large counts overflowing the format.
Related errors
- String is too long:
- Unsupported Arg Type:
- Cannot save type:
- Wrong jadx class set header
- Wrong jadx class set version, got:
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/a6a3f1cb5b58a59c.
Report an issue: GitHub.