{"record":{"id":"4e5d7af432308a12","repo":"pinpoint-apm/pinpoint","slug":"constructor-not-found","errorCode":null,"errorMessage":"constructor not found ","messagePattern":"constructor not found ","errorType":"exception","errorClass":"PinpointException","httpStatus":null,"severity":"error","filePath":"agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/instrument/transformer/TransformCallbackChecker.java","lineNumber":57,"sourceCode":"        if (enclosingClass != null) {\n            // inner class state\n\n            // check static class\n            int modifiers = transformCallbackClass.getModifiers();\n            if (!Modifier.isStatic(modifiers)) {\n                throw new PinpointException(\"transformCallbackClass must be static inner class. class:\" + transformCallbackClass.getName());\n            }\n        }\n//        final Method enclosingMethod = transformCallbackClass.getEnclosingMethod();\n//        if (enclosingMethod != null) {\n//            throw new PinpointException(\"Local Inner class not support \" + transformCallbackClass.getName());\n//        }\n\n        try {\n            // check default constructor\n            transformCallbackClass.getConstructor(parameterTypes);\n        } catch (NoSuchMethodException e) {\n            throw new PinpointException(\"constructor not found \" + transformCallbackClass.getName(), e);\n        }\n    }\n}\n","sourceCodeStart":39,"sourceCodeEnd":61,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/instrument/transformer/TransformCallbackChecker.java#L39-L61","documentation":"TransformCallbackChecker.validate requires the TransformCallback class to expose a constructor matching the given parameterTypes, so the instrumentation layer can instantiate it reflectively. If getConstructor(parameterTypes) raises NoSuchMethodException, a PinpointException wrapping it is thrown.","triggerScenarios":"Calling TransformTemplate.transform(className, callbackClass, parameters, parameterTypes) where the callback class has no public constructor whose signature equals parameterTypes (e.g. callback declares no constructor but parameters are passed, or constructor parameter types differ).","commonSituations":"Passing parameters to a callback whose constructor takes none; mismatched types (int vs Integer, String vs custom type); constructor not public.","solutions":["Add or fix a public constructor in the TransformCallback whose parameter types exactly match the parameterTypes array","Pass null parameters/parameterTypes when the callback has a no-arg constructor path allowed by the API","Make the constructor public — getConstructor only finds public constructors","Align with supported parameter types (see ParameterUtils.checkParameterType)"],"exampleFix":"// before\ntransformer.transform(\"Foo\", MyCallback.class, null, new Class[]{String.class}); // no String ctor\n// after\nclass MyCallback implements TransformCallback {\n    public MyCallback(String name) { ... }\n}\ntransformer.transform(\"Foo\", MyCallback.class, new Object[]{\"x\"}, new Class[]{String.class});","handlingStrategy":"validation","validationCode":"try {\n    MyCallback.class.getConstructor(parameterTypes == null ? new Class<?>[0] : parameterTypes);\n} catch (NoSuchMethodException e) {\n    throw new IllegalStateException(\"callback lacks public constructor matching parameterTypes\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    transformer.transform(name, cb, params, types);\n} catch (PinpointException e) {\n    if (e.getMessage().startsWith(\"constructor not found\")) {\n        logger.error(\"add a public constructor matching parameterTypes: \" + Arrays.toString(types), e);\n    } else { throw e; }\n}","preventionTips":["Keep an explicit public constructor in every TransformCallback matching the parameters you pass","Pass no parameters for no-arg constructors; match types exactly (int vs Integer)","Only public constructors are found by getConstructor — never rely on package-private"],"tags":["constructor","reflection","transform-callback"],"backgroundTag":"invalid-constructor-argument","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}