oracle/graal · error · IOException

Registration is a singleton

Error message

Registration  is a singleton

What it means

IOException thrown by BinaryReplayCodec.ReadState.instanceProxy when the stream requests an instance proxy (with an id) for a registration that is marked singleton. Singletons have no per-instance identity, so an id-carrying reference to one is structurally invalid — again indicating a corrupt stream or a codec/declarations mismatch between writer and reader builds.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java:301

        }

        private Object singletonProxy(int registrationIndex) throws IOException {
            CompilerInterfaceDeclarations.Registration registration = registrationAt(registrationIndex);
            if (!registration.singleton()) {
                throw new IOException("Registration " + registration.clazz().getName() + " is not a singleton");
            }
            Object proxy = singletonProxies[registrationIndex];
            if (proxy == null) {
                proxy = proxyFactory.createProxy(registration);
                singletonProxies[registrationIndex] = proxy;
            }
            return proxy;
        }

        private Object instanceProxy(int registrationIndex, int id) throws IOException {
            CompilerInterfaceDeclarations.Registration registration = registrationAt(registrationIndex);
            if (registration.singleton()) {
                throw new IOException("Registration " + registration.clazz().getName() + " is a singleton");
            }
            EconomicMap<Integer, Object> proxies = instanceProxies[registrationIndex];
            if (proxies == null) {
                proxies = EconomicMap.create();
                instanceProxies[registrationIndex] = proxies;
            }
            Object proxy = proxies.get(id);
            if (proxy == null) {
                proxy = proxyFactory.createProxy(registration);
                proxies.put(id, proxy);
            }
            return proxy;
        }

        private Architecture registerArchitecture() {
            return (architecture != null) ? architecture : hostTarget.arch;
        }

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Re-record the replay data on the consuming build.
  2. Check the artifact for corruption and re-transfer.
  3. Keep record/replay compiler builds identical.
Defensive patterns

Strategy: validation

Try / catch

try {
    replayCodec.decode(input);
} catch (IOException e) {
    if (e.getMessage().contains("is a singleton")) {
        // stream/declarations mismatch: regenerate replay data on this build
    }
    throw e;
}

Prevention

When it happens

Trigger: An INSTANCE_PROXY record indexes a registration whose singleton() flag is true in the running build — the writer build did not mark it singleton (or the bytes are damaged).

Common situations: Replaying profiles recorded on a different compiler revision where singleton markings of compiler-interface types changed; bit-level corruption of replay files.

Related errors


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