spring-projects/spring-ai · error · IllegalStateException

Unsupported member type:

Error message

Unsupported member type: 

What it means

Thrown by the nullness-checking schema module when the Jackson Member under inspection is neither a Field nor a Method scope, so its nullness cannot be computed while generating a JSON schema for a @Tool method.

Solutions

  1. Simplify the tool's input type to plain fields/properties (POJO or record) that Jackson can introspect as fields/methods
  2. Check for a custom Jackson introspection/module config changing Member kinds and remove it
  3. Report the member type to Spring AI if it should be supported; work around by supplying an explicit JSON schema
  4. Pin/upgrade the Spring AI version — this is likely an internal invariant hit, newer versions may handle the member kind

Example fix

// before (schema module chokes on exotic introspected member)
@Tool String run(MyWeirdInternalType in) {...}
// after — expose a simple input DTO
record RunRequest(String name, int count) {}
@Tool String run(RunRequest in) {...}
Defensive patterns

Strategy: try-catch

Try / catch

try { schema = JsonSchemaGenerator.generateFor(type); }
catch (IllegalStateException e) {
    if (e.getMessage().startsWith("Unsupported member type")) {
        schema = /* hand-written fallback schema */;
    }
}

Prevention

When it happens

Trigger: JSON schema generation for a tool's input type encounters a member kind the module doesn't handle — typically constructor parameters or exotic member types reached through Jackson introspection of the input record/class.

Common situations: Tool input types with unusual shapes (e.g. types whose introspection surfaces constructor-parameter members); custom Jackson modules altering member resolution; schema generation on types never intended for serialization.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of spring-projects/spring-ai@98a7beda4f (2026-09-11). Data as JSON: /api/errors/4fd4e6c05ecde1ba. Report an issue: GitHub.

Appendix: source

Thrown at spring-ai-model/src/main/java/org/springframework/ai/util/json/schema/AbstractSpringAiSchemaModule.java:122

		if (propertyAnnotation != null) {
			return propertyAnnotation.required();
		}

		var schemaAnnotation = member.getAnnotationConsideringFieldAndGetter(Schema.class);
		if (schemaAnnotation != null) {
			return schemaAnnotation.requiredMode() == Schema.RequiredMode.REQUIRED
					|| schemaAnnotation.requiredMode() == Schema.RequiredMode.AUTO || schemaAnnotation.required();
		}

		Nullness nullness;
		if (member instanceof FieldScope fs) {
			nullness = Nullness.forField(fs.getRawMember());
		}
		else if (member instanceof MethodScope ms) {
			nullness = Nullness.forMethodReturnType(ms.getRawMember());
		}
		else {
			throw new IllegalStateException("Unsupported member type: " + member);
		}
		if (nullness == Nullness.NULLABLE) {
			return false;
		}
		if (KotlinDetector.isKotlinReflectPresent()
				&& KotlinDetector.isKotlinType(member.getDeclaringType().getErasedType())) {
			// Defer to KotlinModule for additional checks like default values
			return false;
		}

		return this.requiredByDefault;
	}

	/**
	 * Options for customizing the behavior of the module.
	 */
	public enum Option {

View on GitHub (pinned to 98a7beda4f)