{"record":{"id":"8a4d0e315ab49743","repo":"spring-projects/spring-framework","slug":"cannot-convert-value-of-type-to-required-type-8a4d0e","errorCode":null,"errorMessage":"Cannot convert value of type '{}' to required type '{}'[ for property '{}']: no matching editors or conversion strategy found","messagePattern":"Cannot convert value of type '(.+?)' to required type '(.+?)'\\[ for property '(.+?)'\\]: no matching editors or conversion strategy found","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java","lineNumber":270,"sourceCode":"\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Definitely doesn't match: throw IllegalArgumentException/IllegalStateException\n\t\t\t\tStringBuilder msg = new StringBuilder();\n\t\t\t\tmsg.append(\"Cannot convert value of type '\").append(ClassUtils.getDescriptiveType(newValue));\n\t\t\t\tmsg.append(\"' to required type '\").append(ClassUtils.getQualifiedName(requiredType)).append('\\'');\n\t\t\t\tif (propertyName != null) {\n\t\t\t\t\tmsg.append(\" for property '\").append(propertyName).append('\\'');\n\t\t\t\t}\n\t\t\t\tif (editor != null) {\n\t\t\t\t\tmsg.append(\": PropertyEditor [\").append(editor.getClass().getName()).append(\n\t\t\t\t\t\t\t\"] returned inappropriate value of type '\").append(\n\t\t\t\t\t\t\tClassUtils.getDescriptiveType(convertedValue)).append('\\'');\n\t\t\t\t\tthrow new IllegalArgumentException(msg.toString());\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tmsg.append(\": no matching editors or conversion strategy found\");\n\t\t\t\t\tthrow new IllegalStateException(msg.toString());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (conversionAttemptEx != null) {\n\t\t\tif (editor == null && !standardConversion && requiredType != null && Object.class != requiredType) {\n\t\t\t\tthrow conversionAttemptEx;\n\t\t\t}\n\t\t\tlogger.debug(\"Original ConversionService attempt failed - ignored since \" +\n\t\t\t\t\t\"PropertyEditor based conversion eventually succeeded\", conversionAttemptEx);\n\t\t}\n\n\t\treturn (T) convertedValue;\n\t}\n\n\tprivate Object attemptToConvertStringToEnum(Class<?> requiredType, String trimmedValue, Object currentConvertedValue) {\n\t\tObject convertedValue = currentConvertedValue;\n","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/69bf83ad716d0cfc4b0520a19b4d8b24c79d1538/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java#L252-L288","documentation":"IllegalStateException from TypeConverterDelegate when no PropertyEditor and no ConversionService path could convert the value to the required type. Unlike error 185, no editor participated (or none returned an incompatible value); Spring simply has no strategy for the conversion. Reached at line 270 after canConvert(...) returns false (or conversionService is null).","triggerScenarios":"Binding a property of type X from a String (or other value) when no PropertyEditor is registered for X and the configured ConversionService has no matching Converter. Common with custom value types, record components, or third-party types in @ConfigurationProperties / DataBinder.","commonSituations":"Using a custom type in a @ConfigurationProperties bean without registering a converter; binding to a java.time type before the default converters are active; removing the default editors via setDefaultEditorsActive(false).","solutions":["Register a Converter<SourceType, TargetType> with the ConversionService (e.g. DefaultConversionService.addConverter).","Register a PropertyEditor for the required type via registerCustomEditor.","Make the source type convertible (e.g. add a String constructor or static valueOf) so a fallback editor can handle it.","Bind to a primitive/wrapper and convert manually afterwards."],"exampleFix":"// before — binding \"2023-01-01\" to a custom LocalDate holder with no converter\n//   -> 'no matching editors or conversion strategy found'\n\n// after — register a converter\nconversionService.addConverter(new Converter<String, LocalDate>() {\n    public LocalDate convert(String s) { return LocalDate.parse(s); }\n});","handlingStrategy":"validation","validationCode":"// Confirm a conversion path exists before binding\nTypeDescriptor src = TypeDescriptor.forObject(value);\nif (!conversionService.canConvert(src, TypeDescriptor.valueOf(requiredType))) {\n    throw new IllegalStateException(\"no converter \" + value.getClass() + \" -> \" + requiredType);\n}","typeGuard":"static boolean canConvert(ConversionService cs, Object v, Class<?> t) {\n    return cs != null && cs.canConvert(TypeDescriptor.forObject(v), TypeDescriptor.valueOf(t));\n}","tryCatchPattern":null,"preventionTips":["Register a Converter for every custom value type used in binding.","Wire a DefaultConversionService into BeanWrapper / @ConfigurationProperties binding.","Add a startup assertion listing convertible types for your domain."],"tags":["type-conversion","conversion-service","binding"],"backgroundTag":null,"analyzedSha":"69bf83ad716d0cfc4b0520a19b4d8b24c79d1538","analyzedAt":"2026-08-09T15:32:58.770Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}