{"record":{"id":"fd8233fe2e08217f","repo":"oracle/graal","slug":"error-adding-s-to-event-set-d-s","errorCode":null,"errorMessage":"Error adding %s to event set %d: %s\n","messagePattern":"Error adding (.+?) to event set (.+?): (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/src/org.graalvm.papibridge/src/papibridge.c","lineNumber":72,"sourceCode":" * @param cls The Java class that this native method belongs to.\n * @param eventNames An array of event names to be added to the event set.\n *\n * @return The handle of the created event set, or PAPI_NULL if an error occurs.\n */\nJNIEXPORT jint JNICALL Java_jdk_graal_compiler_hotspot_replaycomp_HardwarePerformanceCounters_createEventSet(JNIEnv *env, jclass cls,\n                                                                                                             jobjectArray eventNames) {\n    int eventset = PAPI_NULL;\n    int retval = PAPI_create_eventset(&eventset);\n    if (retval != PAPI_OK) {\n        fprintf(stderr, \"Error creating an event set: %s\\n\", PAPI_strerror(retval));\n        return PAPI_NULL;\n    }\n    jsize arrayLen = (*env)->GetArrayLength(env, eventNames);\n    for (jsize i = 0; i < arrayLen; i++) {\n        jstring eventNameString = (jstring) (*env)->GetObjectArrayElement(env, eventNames, i);\n        const char *eventName = (*env)->GetStringUTFChars(env, eventNameString, 0);\n        if ((retval = PAPI_add_named_event(eventset, eventName)) != PAPI_OK) {\n            fprintf(stderr, \"Error adding %s to event set %d: %s\\n\", eventName, eventset, PAPI_strerror(retval));\n            (*env)->ReleaseStringUTFChars(env, eventNameString, eventName);\n            (*env)->DeleteLocalRef(env, eventNameString);\n            PAPI_destroy_eventset(&eventset);\n            return PAPI_NULL;\n        }\n        (*env)->ReleaseStringUTFChars(env, eventNameString, eventName);\n        (*env)->DeleteLocalRef(env, eventNameString);\n    }\n    return eventset;\n}\n\n/**\n * Returns the PAPI_NULL constant.\n *\n * @return The PAPI_NULL constant.\n */\nJNIEXPORT jint JNICALL Java_jdk_graal_compiler_hotspot_replaycomp_HardwarePerformanceCounters_getNull(JNIEnv *env, jclass cls) {\n    return PAPI_NULL;","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/org.graalvm.papibridge/src/papibridge.c#L54-L90","documentation":"Error \"Error adding %s to event set %d: %s\n\" thrown in oracle/graal.","triggerScenarios":"Thrown at compiler/src/org.graalvm.papibridge/src/papibridge.c:72 when the library encounters an invalid state.","commonSituations":"Occurs when a caller violates the contract guarded by this check: Error adding {} to event set {}: {}","solutions":["Fix the condition reported by the error: Error adding {} to 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 adding {} to 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"}