{"record":{"id":"6215d6ac2997e697","repo":"apache/cassandra","slug":"route-index-is-only-allowed-for-accord-journal-tab","errorCode":null,"errorMessage":"Route index is only allowed for accord journal table; given %s","messagePattern":"Route index is only allowed for accord journal table; given (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/index/accord/RouteJournalIndex.java","lineNumber":150,"sourceCode":"        Tracker tracker = baseCfs.getTracker();\n        tracker.subscribe(this);\n    }\n\n    public static boolean allowed(JournalKey id)\n    {\n        return id.type == JournalKey.Type.COMMAND_DIFF && allowed(id.id);\n    }\n\n    public static boolean allowed(TxnId id)\n    {\n        return id.is(Range);\n    }\n\n    private static void validateTargets(ColumnFamilyStore baseCfs, IndexMetadata indexMetadata)\n    {\n        // this contains 2 columns....\n        if (!SchemaConstants.ACCORD_KEYSPACE_NAME.equals(baseCfs.getKeyspaceName()))\n            throw new IllegalArgumentException(\"Route index is only allowed for accord journal table; given \" + baseCfs.metadata());\n        if (!AccordKeyspace.JOURNAL.equals(baseCfs.name))\n            throw new IllegalArgumentException(\"Route index is only allowed for accord journal table; given \" + baseCfs.metadata());\n        Set<String> columns = Splitter.on(',').trimResults().omitEmptyStrings().splitToStream(indexMetadata.options.get(\"target\")).collect(Collectors.toSet());\n        Set<String> expected = Set.of(\"record\", \"user_version\");\n        if (!expected.equals(columns))\n            throw new IllegalArgumentException(\"Route index is only allowed for accord journal table, and on the record/user_value columns; given \" + baseCfs.metadata() + \" and columns \" + columns);\n    }\n\n    public IndexMetrics indexMetrics()\n    {\n        return indexMetrics;\n    }\n\n    public RegisterStatus registerStatus()\n    {\n        return registerStatus;\n    }\n","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/accord/RouteJournalIndex.java#L132-L168","documentation":"RouteJournalIndex.validateTargets throws this IllegalArgumentException when a route index is created on a table whose keyspace is not the Accord system keyspace (accord). Route indexes only make sense for the Accord distributed transaction journal, so Cassandra rejects them anywhere else. The keyspace check fires before the table-name and column checks.","triggerScenarios":"CREATE CUSTOM INDEX ... USING 'org.apache.cassandra.index.accord.RouteJournalIndex' on any table outside the 'accord' keyspace.","commonSituations":"Copy-pasting an index definition from the Accord journal table to a user table; scripted schema setup applying journal indexes to all tables.","solutions":["Create the route index only on accord.journal","Remove the RouteJournalIndex definition from non-Accord tables","Use a regular index type (e.g. StorageAttachedIndex) for user tables"],"exampleFix":"// before\nCREATE CUSTOM INDEX route_idx ON my_keyspace.my_table (cols) USING 'org.apache.cassandra.index.accord.RouteJournalIndex';\n// after\nCREATE CUSTOM INDEX route_idx ON accord.journal (record, user_version) USING 'org.apache.cassandra.index.accord.RouteJournalIndex';","handlingStrategy":"validation","validationCode":"if (!\"accord\".equals(cfs.getKeyspaceName())) throw new IllegalStateException(\"RouteJournalIndex requires accord keyspace, got \" + cfs.getKeyspaceName());","typeGuard":null,"tryCatchPattern":"try { validateTargets(baseCfs, indexMetadata); } catch (IllegalArgumentException e) { /* reject index creation for non-Accord tables */ }","preventionTips":["Only attach RouteJournalIndex to accord.journal","Keep Accord internal index definitions in system schema setup code, not user migration scripts"],"tags":["cassandra","accord","index","illegal-argument"],"backgroundTag":"invalid-argument-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}