{"record":{"id":"a3ba5db0b3ec81d9","repo":"apache/cassandra","slug":"nospamlogger-warn-message","errorCode":null,"errorMessage":"noSpamLogger.warn(message)","messagePattern":"noSpamLogger\\.warn\\(message\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java","lineNumber":870,"sourceCode":"     * @return true if the size of the given term is below the maximum term size, false otherwise\n     * \n     * @throws GuardrailViolatedException if a client mutation contains a term that breaches the failure threshold\n     */\n    public boolean validateTermSize(DecoratedKey key, ByteBuffer term, boolean isClientMutation, ClientState state)\n    {\n        if (isClientMutation)\n        {\n            maxTermSizeGuardrail.guard(term.remaining(), indexTermType.columnName(), false, state);\n            return true;\n        }\n\n        if (maxTermSizeGuardrail.failsOn(term.remaining(), state))\n        {\n            String message = indexIdentifier.logMessage(String.format(TERM_OVERSIZE_MESSAGE,\n                                                                      indexTermType.columnName(),\n                                                                      key,\n                                                                      FBUtilities.prettyPrintMemory(term.remaining())));\n            noSpamLogger.warn(message);\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public String toString()\n    {\n        return indexIdentifier.toString();\n    }\n\n    @Override\n    public boolean equals(Object obj)\n    {\n        if (obj == this)\n            return true;\n","sourceCodeStart":852,"sourceCodeEnd":888,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java#L852-L888","documentation":"When validating a row's term size for SAI, if the term exceeds the max_term_size_guardrail threshold, a WARN is emitted through noSpamLogger (rate-limited to avoid log flooding per column/key combination) and the method returns false, meaning the term is rejected for indexing. The mutation itself is not necessarily rejected; the oversized value is simply not added to the index, so indexed queries may not match that row.","triggerScenarios":"Writing a row whose indexed string/ vector/text term exceeds the SAI guardrail maximum term size (configured via max_term_size_guardrail / sai term size limit) — validateTermSizeForRow detects term.remaining() above the limit.","commonSituations":"Inserting very large text/blob values into SAI-indexed columns; application bugs dumping unbounded payloads into indexed columns; tightening the guardrail and existing large rows failing on subsequent compaction-time indexing.","solutions":["Truncate or redesign the data so indexed values fit under the guardrail limit (e.g. index a prefix or hash column).","Raise the max_term_size_guardrail if the large terms are intentional and acceptable for index memory/size.","Remember unindexed rows won't match equality/ANN queries on the oversized terms — account for this in application queries.","Watch for the rate-limited warnings keyed per column to find offending partitions (key is included in the message)."],"exampleFix":"// before: oversized term silently not indexed\nINSERT INTO tbl (id, description) VALUES (1, '<2MB text>');\n// after: keep indexed values small, store full text separately\nINSERT INTO tbl (id, description_hash, full_text_unindexed) VALUES (1, md5(...), '<2MB text>');","handlingStrategy":"validation","validationCode":"// client-side guard before writing\nif (value != null && value.length > MAX_TERM_BYTES) throw new IllegalArgumentException(\"indexed column value exceeds SAI max term size\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bound the size of values written to SAI-indexed columns at the application layer.","Know your cluster's max_term_size_guardrail setting and validate against it.","Store oversized payloads in unindexed columns or external storage; index keys/hashes only.","Track noSpamLogger warnings per column to find offending write paths."],"tags":["sai","guardrail","term-size","indexing"],"backgroundTag":"value-out-of-range","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}