oracle/graal · error

Error adding %s to event set %d: %s

Error message

Error adding %s to event set %d: %s

What it means

Error "Error adding %s to event set %d: %s " thrown in oracle/graal.

Source

Thrown at compiler/src/org.graalvm.papibridge/src/papibridge.c:72

 * @param cls The Java class that this native method belongs to.
 * @param eventNames An array of event names to be added to the event set.
 *
 * @return The handle of the created event set, or PAPI_NULL if an error occurs.
 */
JNIEXPORT jint JNICALL Java_jdk_graal_compiler_hotspot_replaycomp_HardwarePerformanceCounters_createEventSet(JNIEnv *env, jclass cls,
                                                                                                             jobjectArray eventNames) {
    int eventset = PAPI_NULL;
    int retval = PAPI_create_eventset(&eventset);
    if (retval != PAPI_OK) {
        fprintf(stderr, "Error creating an event set: %s\n", PAPI_strerror(retval));
        return PAPI_NULL;
    }
    jsize arrayLen = (*env)->GetArrayLength(env, eventNames);
    for (jsize i = 0; i < arrayLen; i++) {
        jstring eventNameString = (jstring) (*env)->GetObjectArrayElement(env, eventNames, i);
        const char *eventName = (*env)->GetStringUTFChars(env, eventNameString, 0);
        if ((retval = PAPI_add_named_event(eventset, eventName)) != PAPI_OK) {
            fprintf(stderr, "Error adding %s to event set %d: %s\n", eventName, eventset, PAPI_strerror(retval));
            (*env)->ReleaseStringUTFChars(env, eventNameString, eventName);
            (*env)->DeleteLocalRef(env, eventNameString);
            PAPI_destroy_eventset(&eventset);
            return PAPI_NULL;
        }
        (*env)->ReleaseStringUTFChars(env, eventNameString, eventName);
        (*env)->DeleteLocalRef(env, eventNameString);
    }
    return eventset;
}

/**
 * Returns the PAPI_NULL constant.
 *
 * @return The PAPI_NULL constant.
 */
JNIEXPORT jint JNICALL Java_jdk_graal_compiler_hotspot_replaycomp_HardwarePerformanceCounters_getNull(JNIEnv *env, jclass cls) {
    return PAPI_NULL;

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the condition reported by the error: Error adding {} to event set {}: {}
  2. Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call.

Example fix

Validate inputs and environment so that the failing condition does not occur: Error adding {} to event set {}: {}

When it happens

Trigger: Thrown at compiler/src/org.graalvm.papibridge/src/papibridge.c:72 when the library encounters an invalid state.

Common situations: Occurs when a caller violates the contract guarded by this check: Error adding {} to event set {}: {}


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/fd8233fe2e08217f. Report an issue: GitHub.