{"record":{"id":"94db03ae11e56ae4","repo":"spring-projects/spring-ai","slug":"void-warn-string-message","errorCode":null,"errorMessage":"void warn(String message)","messagePattern":"void warn\\(String message\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"mcp/mcp-annotations/src/main/java/org/springframework/ai/mcp/annotation/context/McpAsyncRequestContext.java","lineNumber":97,"sourceCode":"\tMono<Void> progress(Consumer<ProgressSpec> progressSpec);\n\n\tMono<Void> progress(ProgressNotification progressNotification);\n\n\t// --------------------------------------\n\t// Ping\n\t// --------------------------------------\n\tMono<Object> ping();\n\n\t// --------------------------------------\n\t// Logging\n\t// --------------------------------------\n\tMono<Void> log(Consumer<LoggingSpec> logSpec);\n\n\tMono<Void> debug(String message);\n\n\tMono<Void> info(String message);\n\n\tMono<Void> warn(String message);\n\n\tMono<Void> error(String message);\n\n}\n","sourceCodeStart":79,"sourceCodeEnd":102,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/mcp/mcp-annotations/src/main/java/org/springframework/ai/mcp/annotation/context/McpAsyncRequestContext.java#L79-L102","documentation":"This is not an error but the interface method declaration warn(String) on McpAsyncRequestContext: the reactive context API's method to send a WARN-level logging notification to the connected MCP client, returning Mono<Void>. It appears in error listings only because it is an API surface member.","triggerScenarios":"Invoked when a tool implementation calls ctx.warn(\"message\") on an async (reactive) MCP request context to emit a client-side warning log notification.","commonSituations":"Tool code that wants the MCP client (e.g. an LLM host) to display warning logs during tool execution uses this method as part of the logging family log/debug/info/warn/error.","solutions":["Use ctx.warn(\"...\") within an async tool and subscribe to (or chain) the returned Mono<Void>","For imperative code, use the sync context's warn(String) instead"],"exampleFix":"// before (async context, imperative style)\nctx.warn(\"disk nearly full\"); // does nothing alone\n// after\nreturn ctx.warn(\"disk nearly full\").then(Mono.just(result));","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  ctx.warn(\"disk nearly full\").block();\n} catch (Exception e) {\n  logger.warn(\"Failed to deliver warn log notification to MCP client\", e);\n}","preventionTips":["Remember async context logging methods return Mono<Void> and must be subscribed","Chain logging Monos into the tool's reactive pipeline","Use the sync context for imperative logging"],"tags":["spring-ai","mcp","api-surface","logging","async-context"],"backgroundTag":null,"analyzedSha":"98a7beda4f29d80a71c5837eb4053b03a93a46f7","analyzedAt":"2026-09-11T14:15:49.441Z","contentChangedAt":"2026-09-11T14:15:49.441Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}