{"record":{"id":"c2904f9bf25767f1","repo":"spring-projects/spring-framework","slug":"typedescriptor-resolution-not-supported","errorCode":null,"errorMessage":"TypeDescriptor resolution not supported","messagePattern":"TypeDescriptor resolution not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spring-beans/src/main/java/org/springframework/beans/TypeConverter.java","lineNumber":114,"sourceCode":"\t * Convert the value to the required type (if necessary from a String).\n\t * <p>Conversions from String to any type will typically use the {@code setAsText}\n\t * method of the PropertyEditor class, or a Spring Converter in a ConversionService.\n\t * @param value the value to convert\n\t * @param requiredType the type we must convert to\n\t * (or {@code null} if not known, for example in case of a collection element)\n\t * @param typeDescriptor the type descriptor to use (may be {@code null}))\n\t * @return the new value, possibly the result of type conversion\n\t * @throws TypeMismatchException if type conversion failed\n\t * @since 5.1.4\n\t * @see java.beans.PropertyEditor#setAsText(String)\n\t * @see java.beans.PropertyEditor#getValue()\n\t * @see org.springframework.core.convert.ConversionService\n\t * @see org.springframework.core.convert.converter.Converter\n\t */\n\tdefault <T> @Nullable T convertIfNecessary(@Nullable Object value, @Nullable Class<T> requiredType,\n\t\t\t@Nullable TypeDescriptor typeDescriptor) throws TypeMismatchException {\n\n\t\tthrow new UnsupportedOperationException(\"TypeDescriptor resolution not supported\");\n\t}\n\n}\n","sourceCodeStart":96,"sourceCodeEnd":118,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/69bf83ad716d0cfc4b0520a19b4d8b24c79d1538/spring-beans/src/main/java/org/springframework/beans/TypeConverter.java#L96-L118","documentation":"UnsupportedOperationException thrown by the default method TypeConverter.convertIfNecessary(value, requiredType, TypeDescriptor). The interface ships this overload as a default that deliberately fails; real implementations (TypeConverterSupport, BeanWrapperImpl, SimpleTypeConverter) override it to delegate to a TypeConverterDelegate. Hitting it means a custom/minimal TypeConverter implementation did not override the TypeDescriptor-aware overload.","triggerScenarios":"Implementing TypeConverter directly and only overriding the (value, requiredType) or (value, requiredType, Field) overloads, then code calling the three-argument TypeDescriptor variant (used by DataBinder, SpEL, and @ConfigurationProperty binding since 5.1.4).","commonSituations":"Custom TypeConverter stubs in tests; lightweight frameworks that predate Spring 5.1 and were never updated for the TypeDescriptor overload; mocking TypeConverter without stubbing all overloads.","solutions":["Extend TypeConverterSupport (or BeanWrapperImpl / SimpleTypeConverter) instead of implementing TypeConverter from scratch so you inherit the delegation.","If you must implement the interface, override convertIfNecessary(value, requiredType, TypeDescriptor) to delegate to your own TypeConverterDelegate.","Update the calling code to use an overload your converter supports, though this is rarely the right fix."],"exampleFix":"// before\npublic class MyConverter implements TypeConverter {\n    public <T> T convertIfNecessary(Object v, Class<T> t, Field f) { /* ... */ }\n}\n\n// after — extend support class instead of re-implementing\npublic class MyConverter extends TypeConverterSupport {\n    // inherits TypeDescriptor delegation; supply a TypeConverterDelegate if needed\n}","handlingStrategy":"type-guard","validationCode":"// Ensure your converter supports the TypeDescriptor overload before it is called\nif (!(converter instanceof TypeConverterSupport)) {\n    throw new IllegalStateException(\"converter must support TypeDescriptor conversion\");\n}","typeGuard":"static boolean supportsTypeDescriptor(TypeConverter c) {\n    return c instanceof TypeConverterSupport || c instanceof BeanWrapper;\n}","tryCatchPattern":null,"preventionTips":["Extend TypeConverterSupport/BeanWrapperImpl rather than implementing TypeConverter directly.","When mocking TypeConverter, stub all three convertIfNecessary overloads.","Keep custom TypeConverter implementations up to date with Spring 5.1+ API."],"tags":["type-conversion","api-misuse","unsupported-operation"],"backgroundTag":null,"analyzedSha":"69bf83ad716d0cfc4b0520a19b4d8b24c79d1538","analyzedAt":"2026-08-09T15:32:58.770Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}