{"record":{"id":"5c2861a58fe938f6","repo":"apache/cassandra","slug":"wrong-parameters-passed-to-stop-async-profiler-met","errorCode":null,"errorMessage":"Wrong parameters passed to stop async profiler method. Passed parameters should be: ${ASYNC_PROFILER_STOP_PARAMS}","messagePattern":"Wrong parameters passed to stop async profiler method\\. Passed parameters should be: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/AsyncProfilerService.java","lineNumber":465,"sourceCode":"        {\n            throw new RuntimeException(\"Unable to create directory \" + logDir);\n        }\n    }\n\n    private void validateStartParameters(Map<String, String> parameters)\n    {\n        if (!ASYNC_PROFILER_START_PARAMS.equals(parameters.keySet()))\n        {\n            throw new IllegalArgumentException(\"Wrong parameters passed to start async profiler method. Passed parameters\" +\n                                               \" should be: \" + ASYNC_PROFILER_START_PARAMS);\n        }\n    }\n\n    private void validateStopParameters(Map<String, String> parameters)\n    {\n        if (!ASYNC_PROFILER_STOP_PARAMS.containsAll(parameters.keySet()))\n        {\n            throw new IllegalArgumentException(\"Wrong parameters passed to stop async profiler method. Passed parameters\" +\n                                               \" should be: \" + ASYNC_PROFILER_STOP_PARAMS);\n        }\n    }\n\n    private boolean isRunning()\n    {\n        if (!isEnabled())\n            return false;\n\n        try\n        {\n            String status = status();\n            return status != null && status.contains(\"Profiling is running\");\n        }\n        catch (Throwable t)\n        {\n            throw new RuntimeException(t);\n        }","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/AsyncProfilerService.java#L447-L483","documentation":"AsyncProfilerService.stop validates that the parameter map for stopping the profiler contains only keys from the allowed ASYNC_PROFILER_STOP_PARAMS set (containsAll, so extra unknown keys are rejected). If any parameter key is not in the allowed set, an IllegalArgumentException is thrown.","triggerScenarios":"Calling AsyncProfilerService.stop with a Map<String,String> containing a key not present in ASYNC_PROFILER_STOP_PARAMS, e.g. passing start-only options like 'event' to stop.","commonSituations":"Reusing the same options map for start and stop calls; typos in stop parameters; clients built against an older parameter list.","solutions":["Pass only parameters listed in ASYNC_PROFILER_STOP_PARAMS (an empty map is typically valid since containsAll accepts it)","Remove start-specific options from the stop call","Verify accepted stop parameters for your Cassandra version"],"exampleFix":"// before\nservice.stop(Map.of(\"event\", \"cpu\"));\n// after\nservice.stop(Map.of());","handlingStrategy":"validation","validationCode":"if (!AsyncProfilerService.ASYNC_PROFILER_STOP_PARAMS.containsAll(params.keySet()))\n    throw new IllegalArgumentException(\"stop params must be a subset of \" + AsyncProfilerService.ASYNC_PROFILER_STOP_PARAMS);\nservice.stop(params);","typeGuard":null,"tryCatchPattern":"try { service.stop(params); } catch (IllegalArgumentException e) { logger.warn(\"Bad profiler stop params: {}\", e.getMessage()); }","preventionTips":["Do not reuse the start options map for stop; use an empty map or stop-specific keys only","Keep start and stop parameter construction in separate helpers","Cover the stop path in tests with the exact allowed key set"],"tags":["profiling","validation","illegal-argument"],"backgroundTag":"invalid-argument-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}