{"record":{"id":"b4c1160fd1afc7a5","repo":"apache/cassandra","slug":"unknown-target-column","errorCode":null,"errorMessage":"unknown target column","messagePattern":"unknown target column","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/index/sasi/SASIIndex.java","lineNumber":161,"sourceCode":"                toRebuild.put(sstable, (perSSTable = new HashMap<>()));\n\n            perSSTable.put(index.getDefinition(), index);\n        }\n\n        CompactionManager.instance.submitIndexBuild(new SASIIndexBuilder(baseCfs, toRebuild));\n    }\n\n    /**\n     * Called via reflection at {@link IndexMetadata#validateCustomIndexOptions}\n     */\n    public static Map<String, String> validateOptions(Map<String, String> options, TableMetadata metadata)\n    {\n        if (!(metadata.partitioner instanceof Murmur3Partitioner))\n            throw new ConfigurationException(\"SASI only supports Murmur3Partitioner.\");\n\n        String targetColumn = options.get(\"target\");\n        if (targetColumn == null)\n            throw new ConfigurationException(\"unknown target column\");\n\n        Pair<ColumnMetadata, IndexTarget.Type> target = TargetParser.parse(metadata, targetColumn);\n        if (target == null)\n            throw new ConfigurationException(\"failed to retrieve target column for: \" + targetColumn);\n\n        if (target.left.isComplex())\n            throw new ConfigurationException(\"complex columns are not yet supported by SASI\");\n\n        if (target.left.isPartitionKey())\n            throw new ConfigurationException(\"partition key columns are not yet supported by SASI\");\n\n        IndexMode.validateAnalyzer(options, target.left);\n\n        IndexMode mode = IndexMode.getMode(target.left, options);\n        if (mode.mode == Mode.SPARSE)\n        {\n            if (mode.isLiteral)\n                throw new ConfigurationException(\"SPARSE mode is only supported on non-literal columns.\");","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sasi/SASIIndex.java#L143-L179","documentation":"SASI indexes require an explicit 'target' option naming the indexed column. validateOptions throws this ConfigurationException when the options map passed at index creation contains no 'target' key, because without it the index has nothing to index.","triggerScenarios":"Creating a SASI index via CREATE CUSTOM INDEX ... WITH options where the options map omits 'target', or programmatically calling SASIIndex.validateOptions(metadata, options) with a map lacking entry 'target'.","commonSituations":"Hand-written CQL CREATE CUSTOM INDEX statements that set analyzer/mode options but forget the target column; tooling generating index options programmatically that misses the required key; copy-pasting SASI options from examples that used an implicit column list.","solutions":["Add the 'target' option to the index options: {\"target\": \"column_name\"} or in CQL: CREATE CUSTOM INDEX ... ON table (column_name) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = {...}.","If using CQL syntax, place the target column in the parenthesized column list of CREATE CUSTOM INDEX — Cassandra populates the 'target' option from it.","Verify the options map passed to validateOptions with a debug print/log before index creation."],"exampleFix":"// before\nCREATE CUSTOM INDEX ON users (full_name) USING 'org.apache.cassandra.index.sasi.SASIIndex'\n  WITH OPTIONS = {'mode': 'CONTAINS'};\n// after\nCREATE CUSTOM INDEX ON users (full_name) USING 'org.apache.cassandra.index.sasi.SASIIndex'\n  WITH OPTIONS = {'target': 'full_name', 'mode': 'CONTAINS'};","handlingStrategy":"validation","validationCode":"// before creating the index\nif (indexOptions.get(\"target\") == null)\n    throw new IllegalArgumentException(\"SASI index requires a 'target' option\");","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(createIndexStmt);\n} catch (com.datastax.driver.core.exceptions.InvalidQueryException e) {\n    if (e.getMessage().contains(\"unknown target column\")) { /* fix options and retry */ }\n}","preventionTips":["Always place the indexed column in the CREATE CUSTOM INDEX column list so Cassandra fills 'target' automatically.","Lint index-definition templates to require the 'target' key for SASI indexes."],"tags":["sasi","index-configuration","configuration-exception","cassandra"],"backgroundTag":"missing-required-config-field","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"}