{"record":{"id":"c3930355374e4ff1","repo":"apache/cassandra","slug":"failed-to-retrieve-target-column-for-s","errorCode":null,"errorMessage":"failed to retrieve target column for: %s","messagePattern":"failed to retrieve target column for: (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/index/sasi/SASIIndex.java","lineNumber":165,"sourceCode":"\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.\");\n\n            if (mode.isAnalyzed)\n                throw new ConfigurationException(\"SPARSE mode doesn't support analyzers.\");\n        }","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sasi/SASIIndex.java#L147-L183","documentation":"After reading the 'target' option, validateOptions passes the column name to TargetParser.parse, which resolves it against the table schema. When the name does not correspond to any column in the table's metadata, parse returns null and this ConfigurationException is thrown.","triggerScenarios":"SASIIndex.validateOptions is called with options where options.get(\"target\") is a non-null string that TargetParser.parse cannot resolve to a ColumnMetadata of the given table (unknown column name, wrong case without quotes, or a qualified/aliased name).","commonSituations":"Typo in the target column name in CREATE CUSTOM INDEX; specifying a column that was dropped or renamed; case mismatch (CQL identifiers are case-sensitive when quoted); pointing the index at a table that does not have the column.","solutions":["Correct the 'target' option to the exact column name as defined in the table schema (run DESCRIBE TABLE to check).","Quote the identifier in CQL if it contains mixed case or special characters: {'target': '\"FullName\"'}.","Ensure the column exists on the target table before creating the index."],"exampleFix":"// before (column is 'email', target misspelled)\nWITH OPTIONS = {'target': 'emial', 'mode': 'PREFIX'};\n// after\nWITH OPTIONS = {'target': 'email', 'mode': 'PREFIX'};","handlingStrategy":"validation","validationCode":"// verify target against schema before creating\nRow row = session.execute(\"SELECT column_name FROM system_schema.columns WHERE keyspace_name=? AND table_name=?\", ks, table).one();\n// or in Java: check metadata.getTable(table).getColumn(targetName) != null before validateOptions","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(createIndexStmt);\n} catch (InvalidQueryException e) {\n    if (e.getMessage().startsWith(\"failed to retrieve target column\")) log.error(\"Unknown SASI target column: {}\", e.getMessage());\n}","preventionTips":["Copy column names from DESCRIBE TABLE output rather than retyping them.","Quote mixed-case identifiers in CQL and in the target option.","Add a schema check step to deployment scripts before index creation."],"tags":["sasi","index-configuration","unknown-column","cassandra"],"backgroundTag":"resource-not-found","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"}