apache/cassandra · error · IllegalArgumentException

Unknown version: " + version

Error message

Unknown version: " + version

What it means

Parses an integer wire version into the Version enum for Accord serializers. Only version 1 exists; any other integer has no corresponding enum constant, so the factory throws IllegalArgumentException rather than returning null. This guards the messaging layer against peers speaking an unknown Accord serialization dialect.

Solutions

  1. Upgrade the node so it recognizes the version being passed (align all nodes to the same Cassandra build).
  2. Verify callers pass an Accord serialization version, not a messaging version.
  3. Wrap the call and fail fast on version negotiation to prevent corrupted deserialization downstream.
Defensive patterns

Strategy: validation

Validate before calling

if (version != 1) throw new IllegalArgumentException("Unsupported Accord version: " + version + ", only 1 is known to this build");

Try / catch

try {
    Version v = Version.fromVersion(rawVersion);
} catch (IllegalArgumentException e) {
    logger.error("Peer sent unknown Accord version; refusing connection", e);
    return; // fail fast, do not attempt deserialization
}

Prevention

When it happens

Trigger: Calling Version.fromVersion(int) with any value other than 1.

Common situations: Version skew during rolling upgrades where a newer node advertises an Accord version this build does not know; misconfigured test harnesses passing raw messaging versions instead of Accord versions.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/bf473b3513d57469. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/service/accord/serializers/Version.java:77

     * For the accord versioned serializers they sometimes need to access existing messaging serializers, in these cases an agreed messaging version is required and can not be plumbed directly from the messaging layer.
     *
     * @see #messageVersion()
     */
    private final MessagingService.Version messagingVersion;

    Version(int version, MessagingService.Version messagingVersion)
    {
        this.version = version;
        this.messagingVersion = messagingVersion;
    }

    public static Version fromVersion(int version)
    {
        switch (version)
        {
            case 1: return V1;
            default:
                throw new IllegalArgumentException("Unknown version: " + version);
        }
    }

    public static Version findBestMatchForMessagingVersion(int messagingVersion)
    {
        Version[] versions = values();
        for (int i = versions.length - 1; i >= 0; i--)
        {
            Version v = versions[i];
            // If network version bumped (12 to 13), the accord serializers may not have been changed; use the largest
            // version smaller than or equal to this version
            if (v.messageVersion() <= messagingVersion)
                return v;
        }
        throw new IllegalArgumentException("Attempted to use message version " + messagingVersion + " which is smaller than " + versions[0] + " can handle (" + versions[0].messageVersion() + ")");
    }

    @Override

View on GitHub (pinned to 88fd0f6a0e)