{"record":{"id":"d0c156e1b9e0d367","repo":"oracle/graal","slug":"error-unable-to-retrieve-event-count-for-event-se","errorCode":null,"errorMessage":"Error: unable to retrieve event count for event set %d: %s\n","messagePattern":"Error: unable to retrieve event count for event set (.+?): (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/src/org.graalvm.papibridge/src/papibridge.c","lineNumber":147,"sourceCode":"        return JNI_FALSE;\n    }\n    return JNI_TRUE;\n}\n\n/**\n * Stops the measurements for the specified PAPI event set and returns the counts.\n *\n * @param env The JNI environment.\n * @param cls The Java class that this native method belongs to.\n * @param eventset The handle of the event set to be stopped.\n *\n * @return A Java long array containing the event counts, or NULL if an error occurs.\n */\nJNIEXPORT jlongArray JNICALL Java_jdk_graal_compiler_hotspot_replaycomp_HardwarePerformanceCounters_stop(JNIEnv *env, jclass cls, jint eventset) {\n    int numberOfEvents = 0;\n    int retval = PAPI_list_events(eventset, NULL, &numberOfEvents);\n    if (retval != PAPI_OK || numberOfEvents <= 0) {\n        fprintf(stderr, \"Error: unable to retrieve event count for event set %d: %s\\n\", eventset, PAPI_strerror(retval));\n        return NULL;\n    }\n    long long *counts = (long long *) malloc(numberOfEvents * sizeof(long long));\n    if (counts == NULL) {\n        fprintf(stderr, \"Error: out of memory for counts\\n\");\n        return NULL;\n    }\n    retval = PAPI_stop(eventset, counts);\n    if (retval != PAPI_OK) {\n        fprintf(stderr, \"Error stopping measurements for event set %d: %s\\n\", eventset, PAPI_strerror(retval));\n        free(counts);\n        return NULL;\n    }\n    jlongArray result = (*env)->NewLongArray(env, numberOfEvents);\n    if (result == NULL) {\n        fprintf(stderr, \"Error: could not allocate Java long array\\n\");\n        free(counts);\n        return NULL;","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/org.graalvm.papibridge/src/papibridge.c#L129-L165","documentation":"Error \"Error: unable to retrieve event count for event set %d: %s\n\" thrown in oracle/graal.","triggerScenarios":"Thrown at compiler/src/org.graalvm.papibridge/src/papibridge.c:147 when the library encounters an invalid state.","commonSituations":"Occurs when a caller violates the contract guarded by this check: Error: unable to retrieve event count for event set {}: {}","solutions":["Fix the condition reported by the error: Error: unable to retrieve event count for event set {}: {}","Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call."],"exampleFix":"Validate inputs and environment so that the failing condition does not occur: Error: unable to retrieve event count for event set {}: {}","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}