{"record":{"id":"52dfa2568a2b0d6c","repo":"aeron-io/aeron","slug":"descriptor-uses-the-same-id-as-other","errorCode":null,"errorMessage":"${descriptor} uses the same id as ${other}","messagePattern":"(.+?) uses the same id as (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"aeron-driver/src/main/java/io/aeron/driver/status/SystemCounterDescriptor.java","lineNumber":365,"sourceCode":"     */\n    NATIVE_RESOURCE_AGENT_PROXY_FAILS(\n        SYSTEM_COUNTER_ID_NATIVE_RESOURCE_AGENT_PROXY_FAILS, \"Failed offers to NativeResourceAgentProxy\");\n\n    /**\n     * All system counters have the same type id, i.e. system counters are the same type. Other types can exist.\n     */\n    public static final int SYSTEM_COUNTER_TYPE_ID = AeronCounters.DRIVER_SYSTEM_COUNTER_TYPE_ID;\n\n    private static final Int2ObjectHashMap<SystemCounterDescriptor> DESCRIPTOR_BY_ID_MAP = new Int2ObjectHashMap<>();\n\n    static\n    {\n        for (final SystemCounterDescriptor descriptor : SystemCounterDescriptor.values())\n        {\n            final SystemCounterDescriptor other = DESCRIPTOR_BY_ID_MAP.put(descriptor.id, descriptor);\n            if (null != other)\n            {\n                throw new IllegalStateException(descriptor + \" uses the same id as \" + other);\n            }\n        }\n    }\n\n    /**\n     * Get the {@link SystemCounterDescriptor} for a given id.\n     *\n     * @param id for the descriptor.\n     * @return the descriptor if found otherwise null.\n     */\n    public static SystemCounterDescriptor get(final int id)\n    {\n        return DESCRIPTOR_BY_ID_MAP.get(id);\n    }\n\n    private final int id;\n    private final String label;\n","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/status/SystemCounterDescriptor.java#L347-L383","documentation":"SystemCounterDescriptor's static initializer registers every enum constant in DESCRIPTOR_BY_ID_MAP and throws IllegalStateException if two descriptors share the same counter id. This is a startup self-check protecting the internal invariant that counter ids are unique; normal users only hit it if they modified the enum or use a patched build.","triggerScenarios":"Adding or duplicating a SystemCounterDescriptor enum constant with an id already used by another constant, or binary-patching/incompatible class transformation that collides ids.","commonSituations":"Custom forks of Aeron adding new system counters without allocating a fresh id; mixing mismatched aeron-driver/aeron-client jar versions on the classpath.","solutions":["Assign the new descriptor a unique id not used by any existing SystemCounterDescriptor.","Check the classpath for duplicate or mismatched Aeron jars and remove the stale one.","If you did not modify the code, report it as a bug with the full stack trace and jar versions."],"exampleFix":"// before\nNEW_COUNTER(\"duplicate-id-conflict\", ...); // id already used\n// after\nNEW_COUNTER(\"unique-unused-id\", ...); // allocate a fresh id","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* trigger class init / driver start */ } catch (IllegalStateException e) { if (e.getMessage().contains(\"uses the same id as\")) { log.error(\"Classpath corruption or patched enum with duplicate counter id\", e); } throw e; }","preventionTips":["Never assign duplicate ids when adding SystemCounterDescriptor constants in forks","Use mvn dependency:tree / unique classpath to avoid mixed Aeron versions","Fail startup loudly and report bug if unmodified upstream code throws this"],"tags":["java","aeron-driver","startup","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}