apache/cassandra · info
text
Error message
text
What it means
ClientWarn.warn queues a warning message (the `text` parameter) into the per-request warn/warnedTables state that is returned to drivers in the response's Warnings frame. If no warning state is attached to the current execution (state == null), the warning is silently dropped.
Solutions
- If the warning is expected client-side, execute it through a normal query path so ClientWarn state exists; nothing to fix in caller code
- For internal code, log via the logger instead of ClientWarn.warn when no client context is present
- Check driver logs / QueryWarnings (e.g. driver's warning handler) to consume warnings — unhandled client warnings are easy to miss
Example fix
// before ClientWarn.instance.warn(msg); // dropped off-request // after if (ClientWarn.instance.get() != null) ClientWarn.instance.warn(msg); else logger.warn(msg);
Defensive patterns
Strategy: try-catch
Type guard
// only warn when a client context exists State state = ClientWarn.instance.get(); if (state != null) ClientWarn.instance.warn(text); else logger.warn(text);
Try / catch
// server-side guard: fall back to logger when no client is attached
try {
ClientWarn.instance.warn(text);
} catch (Exception e) {
logger.warn("Could not deliver warning to client: {}", text, e);
} Prevention
- Register a driver warning handler to actually consume server warnings
- Don't rely on ClientWarn for internal/background code paths — use the logger
- Remember ClientWarn state is thread-local via ExecutorLocals; async code must propagate locals
When it happens
Trigger: Server code calls ClientWarn.instance.warn(text) during query execution; the warning only reaches the client when the ExecutorLocals/ClientState state for the current thread carries a warning State (normal query execution), and it is absent when running outside a client request context.
Common situations: Internal/background code paths (compaction, repair, tooling) that reuse query machinery and invoke warn() with no client attached — warnings vanish; users wondering why a warning from a server-side operation never appears in their driver.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- with (client warning; msg from WarningsSnapshot abort…
- with (client warning; msg from WarningsSnapshot warning…
- Write to . partition …
- Write to . partition …
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/b6c816d927c6c0e1.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/service/ClientWarn.java:46
private static final String TRUNCATED = " [truncated]";
public static ClientWarn instance = new ClientWarn();
private ClientWarn()
{
}
public State get()
{
return ExecutorLocals.current().clientWarnState;
}
public void set(State value)
{
ExecutorLocals current = ExecutorLocals.current();
ExecutorLocals.Impl.set(current.traceState, value, current.eligibleForArtificialLatency);
}
public void warn(String text)
{
State state = get();
if (state != null)
state.add(text);
}
public void captureWarnings()
{
set(new State());
}
/**
* Provides an additional control on capturing warnings. When executing SchemaTransformations in the
* metadata log follower or when committing on a CMS member, we don't want these to be triggered.
* @see org.apache.cassandra.schema.SchemaTransformation#enterExecution()
**/
public void pauseCapture()
{View on GitHub (pinned to 88fd0f6a0e)