alibaba/spring-ai-alibaba · error · IllegalArgumentException

No strategy registered for type:

Error message

No strategy registered for type: 

What it means

Thrown by FlowGraphBuildingStrategyRegistry.createStrategy(String) when no factory is registered under the requested type. The registry only resolves types that were registered (built-ins plus any custom registrations), so this means an unknown or misspelled strategy type. Unlike error 574, the type is non-blank but not recognized.

Source

Thrown at spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/flow/strategy/FlowGraphBuildingStrategyRegistry.java:110

		strategyFactories.put(type, factory);
	}

	/**
	 * Creates a new strategy instance by type. For built-in strategies a new instance is
	 * returned each time; for strategies registered via {@link #registerStrategy(FlowGraphBuildingStrategy)}
	 * the same instance is returned.
	 * @param type the strategy type
	 * @return a strategy implementation
	 * @throws IllegalArgumentException if no strategy is found for the type
	 */
	public FlowGraphBuildingStrategy createStrategy(String type) {
		if (type == null || type.trim().isEmpty()) {
			throw new IllegalArgumentException("Strategy type cannot be null or empty");
		}

		Supplier<FlowGraphBuildingStrategy> factory = strategyFactories.get(type);
		if (factory == null) {
			throw new IllegalArgumentException("No strategy registered for type: " + type);
		}

		return factory.get();
	}

	/**
	 * Gets a strategy by type (delegates to the registered factory).
	 * @param type the strategy type
	 * @return the strategy implementation
	 * @throws IllegalArgumentException if no strategy is found for the type
	 */
	public FlowGraphBuildingStrategy getStrategy(String type) {
		return createStrategy(type);
	}

	/**
	 * Checks if a strategy is registered for the given type.
	 * @param type the strategy type

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Check the exact registered type strings and fix the typo/casing.
  2. Call registerStrategy(type, factory) for your custom type before createStrategy.
  3. Ensure the module defining/registering the strategy is a dependency and its registration code executes.
  4. List available types via registry inspection (e.g. getRegisteredTypes, if present) to confirm valid values.

Example fix

// before
registry.createStrategy("sequantial");
// after
registry.createStrategy("sequential"); // or register: registry.registerStrategy("sequantial", ...) if intentional
Defensive patterns

Strategy: validation

When it happens

Trigger: createStrategy("sequantial") (typo); asking for a custom strategy type before registerStrategy was called; custom strategy module not on the classpath so its registration never ran; case mismatch ("Parallel" vs "parallel").

Common situations: Typos in YAML/properties strategy type; forgetting to register a custom strategy before use; wrong casing after a refactor; using a type from a newer/older library version that doesn't exist.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/37e5a16a520017dd. Report an issue: GitHub.