skylot/jadx · error · JadxRuntimeException
String is too long:
Error message
String is too long:
What it means
Thrown by ClsSet.writeString() when a string being serialized to the .clst file exceeds 254 bytes in STRING_CHARSET encoding. The binary format uses a single unsigned byte for the length prefix (writeUnsignedByte), so it cannot represent lengths of 255 or greater. This is a format limitation, not a logic error.
Source
Thrown at jadx-core/src/main/java/jadx/core/clsp/ClsSet.java:455
return classes[in.readInt()].getClsType();
case ARRAY:
return ArgType.array(Objects.requireNonNull(readArgType(in)));
case PRIMITIVE:
char shortName = (char) in.readByte();
return ArgType.parse(shortName);
default:
throw new JadxRuntimeException("Unsupported Arg Type: " + ordinal);
}
}
private static void writeString(DataOutputStream out, String name) throws IOException {
byte[] bytes = name.getBytes(STRING_CHARSET);
int len = bytes.length;
if (len >= 0xFF) {
throw new JadxRuntimeException("String is too long: " + name);
}
writeUnsignedByte(out, bytes.length);
out.write(bytes);
}
private static String readString(DataInputStream in) throws IOException {
int len = readUnsignedByte(in);
return readString(in, len);
}
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 {View on GitHub (pinned to e738a26571)
Solutions
- Shorten or rename the offending class/type string so its encoded length stays under 255 bytes.
- If you control the format, extend the length encoding to use two bytes (modify writeString/readString and writeUnsignedByte) — but this is a breaking format change requiring all readers to be updated.
- Exclude the offending classes from the ClsSet export and document the 254-byte name limit.
Example fix
// before
// writeString uses single-byte length, fails at >= 255 bytes
// after: extend to unsigned short (breaking format change)
// private static void writeString(DataOutputStream out, String name) {
// byte[] bytes = name.getBytes(STRING_CHARSET);
// out.writeShort(bytes.length);
// out.write(bytes);
// } Defensive patterns
Strategy: validation
Validate before calling
// Before exporting a ClsSet, validate string lengths
private static void validateStringForExport(String name) {
byte[] bytes = name.getBytes(STRING_CHARSET);
if (bytes.length >= 0xFF) {
throw new IllegalArgumentException(
"Class/type name too long for .clst format (max 254 bytes): " + name);
}
}
// Call before ClsSet.save() for each class name and type variable Try / catch
try {
clsSet.save(outputStream);
} catch (JadxRuntimeException e) {
if (e.getMessage().startsWith("String is too long")) {
// Identify and shorten the offending name
logger.error("Class name exceeds 254-byte format limit. Rename or exclude it.", e);
}
throw e;
} Prevention
- Keep class and type names under 254 bytes when generating custom classpath sets.
- Validate names before exporting rather than relying on the runtime check.
When it happens
Trigger: Calling ClsSet.save() or any codepath that writes a class name, type variable name, or other string whose encoded byte length is >= 255. Most common with extremely long obfuscated class names or deeply nested generic type signatures.
Common situations: Generating a custom .clst classpath that includes heavily obfuscated app classes with very long names. Processing a classpath with generated/templated class names that exceed the byte limit.
Related errors
- Unsupported Arg Type:
- Unsigned byte value is too big:
- 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/000ea1dc9af44743.
Report an issue: GitHub.