{"record":{"id":"0ca894602fb8fecf","repo":"apache/cassandra","slug":"s-does-not-support-type-s","errorCode":null,"errorMessage":"%s does not support type %s","messagePattern":"(.+?) does not support type (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/index/sasi/analyzer/AbstractAnalyzer.java","lineNumber":46,"sourceCode":"\npublic abstract class AbstractAnalyzer implements Iterator<ByteBuffer>\n{\n    protected ByteBuffer next = null;\n\n    public ByteBuffer next()\n    {\n        return next;\n    }\n\n    public void remove()\n    {\n        throw new UnsupportedOperationException();\n    }\n\n    public void validate(Map<String, String> options, ColumnMetadata cm) throws ConfigurationException\n    {\n        if (!isCompatibleWith(cm.type))\n            throw new ConfigurationException(String.format(\"%s does not support type %s\",\n                                                           this.getClass().getSimpleName(),\n                                                           cm.type.asCQL3Type()));\n    }\n\n    public abstract void init(Map<String, String> options, AbstractType<?> validator);\n\n    public abstract void reset(ByteBuffer input);\n\n    /**\n     * Test whether the given validator is compatible with the underlying analyzer.\n     *\n     * @param validator the validator to test the compatibility with\n     * @return true if the give validator is compatible, false otherwise\n     */\n    protected abstract boolean isCompatibleWith(AbstractType<?> validator);\n\n    /**\n     * @return true if current analyzer provides text tokenization, false otherwise.","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sasi/analyzer/AbstractAnalyzer.java#L28-L64","documentation":"Each SASI analyzer declares the column types it can handle via isCompatibleWith(AbstractType<?>). AbstractAnalyzer.validate compares the analyzer against the target column's type and throws this ConfigurationException when they are incompatible (e.g. a text analyzer on a numeric column).","triggerScenarios":"IndexMode.validateAnalyzer(options, column) invokes analyzer.validate and the configured 'analyzer_class' is incompatible with the target column's type — e.g. StandardAnalyzer/NonTokenizingAnalyzer on an int, timestamp, or other non-text column.","commonSituations":"Adding 'analyzed': 'true' with a text analyzer to an index on an int or date column; copy-pasting analyzer options from a text index to a numeric index; custom analyzers with an overly restrictive isCompatibleWith.","solutions":["Remove the analyzer options from the index on the non-text column (analyzers are for literal columns).","If analysis is needed, ensure the target column is a text/ascii/varchar type.","Choose an analyzer class whose isCompatibleWith accepts the column type, or fix a custom analyzer's isCompatibleWith implementation."],"exampleFix":"// before (age is int)\nWITH OPTIONS = {'target': 'age', 'mode': 'PREFIX', 'analyzed': 'true',\n  'analyzer_class': 'org.apache.cassandra.index.sasi.analyzer.StandardAnalyzer'};\n// after\nWITH OPTIONS = {'target': 'age', 'mode': 'PREFIX'};","handlingStrategy":"validation","validationCode":"// only attach analyzers to text-typed columns\nString type = columnType.asCQL3Type().toString();\nif (options.get(\"analyzer_class\") != null && !(type.equals(\"text\") || type.equals(\"ascii\") || type.equals(\"varchar\")))\n    throw new IllegalArgumentException(\"Analyzer not compatible with column type \" + type);","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(createIndexStmt);\n} catch (InvalidQueryException e) {\n    if (e.getMessage().contains(\"does not support type\")) { /* remove analyzer or fix column type */ }\n}","preventionTips":["Restrict analyzer_class options in templates to text/ascii/varchar targets.","Read the analyzer's isCompatibleWith contract before configuring it.","Test index creation against a dev schema with the same column types."],"tags":["sasi","analyzer","type-mismatch","invalid-config-value","cassandra"],"backgroundTag":"type-mismatch","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}