{"record":{"id":"9d3e9e8d56199e6d","repo":"pinpoint-apm/pinpoint","slug":"execute-fail-error","errorCode":null,"errorMessage":"execute fail. Error:","messagePattern":"execute fail\\. Error:","errorType":"exception","errorClass":"BootStrapException","httpStatus":null,"severity":"error","filePath":"agent-module/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/ContextClassLoaderExecuteTemplate.java","lineNumber":51,"sourceCode":"\n    public V execute(Callable<V> callable) throws BootStrapException {\n        try {\n            final Thread currentThread = Thread.currentThread();\n            final ClassLoader before = currentThread.getContextClassLoader();\n            // ctxCl == null safe?\n            currentThread.setContextClassLoader(this.classLoader);\n            try {\n                return callable.call();\n            } finally {\n                // even though  the \"BEFORE\" classloader  is null, rollback  is needed.\n                // if an exception occurs BEFORE callable.call(), the call flow can't reach here.\n                // so  rollback  here is right.\n                currentThread.setContextClassLoader(before);\n            }\n        } catch (BootStrapException ex){\n            throw ex;\n        } catch (Exception ex) {\n            throw new BootStrapException(\"execute fail. Error:\" + ex.getMessage(), ex);\n        }\n    }\n}\n","sourceCodeStart":33,"sourceCodeEnd":55,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/ContextClassLoaderExecuteTemplate.java#L33-L55","documentation":"ContextClassLoaderExecuteTemplate.execute runs a Callable with the thread's context classloader temporarily swapped to the given classloader, then restores it. Any non-BootStrapException thrown inside the block (including InvocationTargetException from the reflective boot-class instantiation in AgentBootLoader) is wrapped in a BootStrapException with the message 'execute fail. Error:'. BootStrapExceptions are rethrown unchanged.","triggerScenarios":"Any exception other than BootStrapException escaping the executed callable — typically the reflective bootClass construction failing (IllegalArgumentException for bad constructor args, InvocationTargetException from a throwing constructor, ExceptionInInitializerError), or a bug in the callback itself.","commonSituations":"Malformed agentArgs map passed to the boot constructor; DefaultAgent static initializer or constructor throwing (bad config, plugin load failure); using the template with a classloader that fails to load classes referenced by the callback.","solutions":["Read the wrapped 'Caused by' chain — the real failure is the original exception inside the execute block, not the wrapper","Fix the underlying cause reported by the cause (config value, missing class, constructor exception)","If InvocationTargetException is the cause, look at its target exception for the exception thrown by the boot class constructor","Validate the agentArgs map keys/values before boot so the constructor receives valid data"],"exampleFix":"// before\nnew ContextClassLoaderExecuteTemplate(bootClassLoader).execute(() -> { ... }); // opaque 'execute fail'\n// after\ntry { ... } catch (BootStrapException e) {\n    log.error(\"boot failed, root cause:\", ExceptionUtils.getRootCause(e));\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return execute(callable);\n} catch (BootStrapException e) {\n    throw e; // already classified\n} catch (Exception e) {\n    throw new BootStrapException(\"execute fail. Error:\" + e.getMessage(), e);\n}","preventionTips":["Inspect 'Caused by' first when diagnosing","Avoid throwing raw exceptions from callables run under this template","Wrap callable bodies to convert known failures into descriptive exceptions"],"tags":["reflection","classloader","java","exception-wrapping"],"backgroundTag":"module-init-failed","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"}