alibaba/arthas · critical · IllegalStateException

Task-aware tools registered but no TaskStore configured. Add

Error message

Task-aware tools registered but no TaskStore configured. Add a TaskStore via .taskStore(store) or remove task tools.

What it means

Thrown at build() time of the McpNettyServer builder (StreamableServerNettySpecification.validateTaskConfiguration) when task-aware tools have been registered via taskTools(...) but no TaskStore was supplied via taskStore(...). The builder forbids this configuration because task tools need a store to persist task state; the inverse (store without task tools) is permitted for future dynamic registration.

Source

Thrown at arthas-mcp-server/src/main/java/com/taobao/arthas/mcp/server/protocol/server/McpServer.java:265

		public StreamableServerNettySpecification taskStore(TaskStore<McpSchema.ServerTaskPayloadResult> taskStore) {
			Assert.notNull(taskStore, "Task store must not be null");
			this.taskStore = taskStore;
			return this;
		}

		public StreamableServerNettySpecification taskMessageQueue(TaskMessageQueue taskMessageQueue) {
			Assert.notNull(taskMessageQueue, "Task message queue must not be null");
			this.taskMessageQueue = taskMessageQueue;
			return this;
		}

		protected void validateTaskConfiguration() {
			boolean hasTaskTools = !this.taskTools.isEmpty();
			boolean hasTaskStore = this.taskStore != null;
			
			if (hasTaskTools && !hasTaskStore) {
				throw new IllegalStateException("Task-aware tools registered but no TaskStore configured. "
						+ "Add a TaskStore via .taskStore(store) or remove task tools.");
			}
			// Note: Having taskStore without taskTools is allowed (for future dynamic registration)
		}

		private void assertNoDuplicateTool(String toolName) {
			for (McpServerFeatures.ToolSpecification tool : this.tools) {
				if (tool.getTool().getName().equals(toolName)) {
					throw new IllegalArgumentException("Duplicate tool name: " + toolName);
				}
			}
			for (TaskAwareToolSpecification taskTool : this.taskTools) {
				if (taskTool.tool().getName().equals(toolName)) {
					throw new IllegalArgumentException("Duplicate tool name: " + toolName);
				}
			}
		}

View on GitHub (pinned to 21cf2e9ba5)

Solutions

  1. Add .taskStore(new InMemoryTaskStore.Builder<>().build()) (or your custom TaskStore) to the builder chain before build().
  2. Alternatively remove the .taskTools(...) calls if you do not need task-aware tool behavior.
  3. Wire the TaskMessageQueue too if your tasks queue side-channel messages.
  4. Review the full builder chain to confirm capabilities and store are consistent.

Example fix

// before
spec.taskTools(myTaskTool).build(); // IllegalStateException

// after
spec.taskStore(new InMemoryTaskStore.Builder<McpSchema.ServerTaskPayloadResult>().build())
    .taskMessageQueue(new DefaultTaskMessageQueue())
    .taskTools(myTaskTool)
    .build();
Defensive patterns

Strategy: validation

Validate before calling

// Validate builder state before build()
boolean hasTaskTools = !taskToolSpecs.isEmpty();
boolean hasStore = taskStore != null;
if (hasTaskTools && !hasStore) {
    throw new IllegalStateException("Configure taskStore before adding task tools");
}
// then build()

Try / catch

try {
    spec.build();
} catch (IllegalStateException e) {
    if (e.getMessage().contains("TaskStore")) {
        // fix wiring: add taskStore then rebuild
        spec.taskStore(new InMemoryTaskStore.Builder<McpSchema.ServerTaskPayloadResult>().build());
        spec.build();
    } else throw e;
}

Prevention

When it happens

Trigger: Calling .taskTools(...) one or more times on the builder, then calling .build() without ever calling .taskStore(...). Also when a TaskMessageQueue is set but the TaskStore is forgotten.

Common situations: Enabling the task-aware tool feature for the first time and missing the store wiring; refactoring that removed the taskStore() call but left task tools; following an incomplete example.

Related errors


AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14). Data as JSON: /api/errors/d6bfb6e4b8e97c71. Report an issue: GitHub.