{"record":{"id":"8e0fba6ae7738ffc","repo":"apache/cassandra","slug":"no-tracestate","errorCode":null,"errorMessage":"no tracestate","messagePattern":"no tracestate","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/repair/RepairCoordinator.java","lineNumber":561,"sourceCode":"            }\n        }\n\n        List<Range<Token>> ranges = new ArrayList<>();\n        ranges.add(range);\n        neighborRangeList.add(new CommonRange(endpoints, transEndpoints, ranges));\n    }\n\n    private Thread createQueryThread(final TimeUUID sessionId)\n    {\n        return ctx.executorFactory().startThread(\"Repair-Runnable-\" + THREAD_COUNTER.incrementAndGet(), new WrappedRunnable()\n        {\n            // Query events within a time interval that overlaps the last by one second. Ignore duplicates. Ignore local traces.\n            // Wake up upon local trace activity. Query when notified of trace activity with a timeout that doubles every two timeouts.\n            public void runMayThrow() throws Exception\n            {\n                TraceState state = Tracing.instance.get(sessionId);\n                if (state == null)\n                    throw new Exception(\"no tracestate\");\n\n                String format = \"select event_id, source, source_port, activity from %s.%s where session_id = ? and event_id > ? and event_id < ?;\";\n                String query = String.format(format, SchemaConstants.TRACE_KEYSPACE_NAME, TraceKeyspace.EVENTS);\n                SelectStatement statement = (SelectStatement) QueryProcessor.parseStatement(query).prepare(ClientState.forInternalCalls());\n\n                ByteBuffer sessionIdBytes = sessionId.toBytes();\n                InetAddressAndPort source = ctx.broadcastAddressAndPort();\n\n                HashSet<UUID>[] seen = new HashSet[]{ new HashSet<>(), new HashSet<>() };\n                int si = 0;\n                UUID uuid;\n\n                long tlast = ctx.clock().currentTimeMillis(), tcur;\n\n                TraceState.Status status;\n                long minWaitMillis = 125;\n                long maxWaitMillis = 1000 * 1024L;\n                long timeout = minWaitMillis;","sourceCodeStart":543,"sourceCodeEnd":579,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/repair/RepairCoordinator.java#L543-L579","documentation":"TraceStateJob.runMayThrow throws a plain Exception when Tracing.instance.get(sessionId) returns null, meaning the local TraceState for the session UUID has been dropped (tracing TTL expired) or never existed on this node. The job polls the trace events table for a session whose local state is already gone.","triggerScenarios":"The trace-watcher thread wakes for sessionId but the TraceState was evicted after query completion before events were fetched; or a session UUID is watched that was never created locally.","commonSituations":"Inspecting traces of long queries after the tracing TTL elapsed; heavy tracing load evicting states quickly; fetching traces for sessions started on other nodes.","solutions":["Fetch trace events within the tracing TTL window (before state expiry)","Increase tracing_ttl_seconds in cassandra.yaml if traces are read late","Verify the session UUID is correct and was created on this node","Re-run the operation with TRACING ON to generate a fresh session"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"TraceState state = Tracing.instance.get(sessionId);\nif (state == null) { /* session expired; skip polling */ return; }","typeGuard":null,"tryCatchPattern":"try { pollTraces(sessionId); }\ncatch (Exception e) {\n    if (\"no tracestate\".equals(e.getMessage()))\n        logger.warn(\"Trace session {} expired before events could be read\", sessionId);\n    else throw e;\n}","preventionTips":["Read trace events promptly, within the tracing TTL","Raise tracing_ttl_seconds if traces are inspected later","Verify the session UUID was created on this node"],"tags":["tracing","timeout","session-expired"],"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-17T15:17:12.973Z"}