pinpoint-apm/pinpoint · error · InstrumentException
ClassReader fail, classFile=
Error message
ClassReader fail, classFile=
What it means
toMainClassByteArray reads the bundled InterceptorHolder.class template from the profiler classloader and rewrites it with ASM. This InstrumentException wraps an IOException from readClass — either the template resource was not found on the classpath (InputStream null) or the class bytes failed to be parsed by ASM's ClassReader (corrupted resource).
Solutions
- Verify the profiler jar contains InterceptorHolder.class at the exact package path (jar tf)
- Re-download/re-extract the Pinpoint agent distribution to fix a corrupted jar
- Check getCause(): 'not found class ...' means missing resource; a format error means ASM/JDK version mismatch
- If shading the agent, keep the template resource and matching ASM dependency in the shaded artifact
Defensive patterns
Strategy: validation
Validate before calling
// verify template resource before generating bytes
String tpl = "com/navercorp/pinpoint/profiler/instrument/interceptor/InterceptorHolder.class";
if (ASMInterceptorHolder.class.getClassLoader().getResourceAsStream(tpl) == null) {
throw new IllegalStateException("missing profiler template resource: " + tpl);
} Try / catch
try {
holder.defineClass(classLoader);
} catch (InstrumentException e) {
if (e.getCause() instanceof IOException) {
logger.error("template read failed — profiler jar corrupt or mis-shaded: {}", e.getMessage());
}
} Prevention
- Verify jar contents after build: jar tf | grep InterceptorHolder.class
- Avoid relocation/shading that drops or renames template resources
- Use full official agent distributions, not partially copied jars
When it happens
Trigger: Calling toMainClassByteArray (via defineClass/build) when com/navercorp/pinpoint/profiler/instrument/interceptor/InterceptorHolder.class is absent from the agent classpath or its bytes are corrupt/incompatible with the bundled ASM ClassReader.
Common situations: Broken shading/relocation of the profiler jar by a downstream packager, an incomplete agent deployment, or mixing ASM versions so ClassReader rejects a newer class-file version.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- @Aspect not found. adviceClass=
- defineClass fail
- invalid class hierarchy. source class=
- No methods are intercepted. target
- No methods are intercepted. target
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/e06989a205cdd7fc.
Report an issue: GitHub.
Appendix: source
Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMInterceptorHolder.java:160
final Class<?> mainClass = InterceptorDefineClassHelper.defineClass(classLoader, className, mainClassBytes);
final byte[] innerClassByte = toInnerClassByteArray();
InterceptorDefineClassHelper.defineClass(classLoader, innerClassName, innerClassByte);
return mainClass;
} catch (Exception e) {
throw new InstrumentException("defineClass fail", e);
}
}
byte[] toMainClassByteArray() throws InstrumentException {
try {
ClassNode classNode = readClass(INTERCEPTOR_HOLDER_CLASS);
final ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
final ClassVisitor renameClassAdapter = new RenameClassAdapter(classWriter, className);
classNode.accept(renameClassAdapter);
return classWriter.toByteArray();
} catch (IOException e) {
// read fail
throw new InstrumentException("ClassReader fail, classFile=" + INTERCEPTOR_HOLDER_CLASS, e);
}
}
byte[] toInnerClassByteArray() throws InstrumentException {
try {
ClassNode classNode = readClass(INTERCEPTOR_HOLDER_INNER_CLASS);
final ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
final ClassVisitor renameClassAdapter = new RenameInnerClassAdapter(classWriter, className);
classNode.accept(renameClassAdapter);
return classWriter.toByteArray();
} catch (IOException e) {
// read fail
throw new InstrumentException("ClassReader fail, classFile=" + INTERCEPTOR_HOLDER_INNER_CLASS, e);
}
}
ClassNode readClass(String classFileName) throws IOException {
final ClassLoader classLoader = ASMInterceptorHolder.class.getClassLoader();View on GitHub (pinned to 744c3d3075)