apache/shardingsphere · error · TypedPropertyValueException

Value `%s` of `%s` cannot convert to type `%s`

Error message

Value `%s` of `%s` cannot convert to type `%s`

What it means

Error "Value `%s` of `%s` cannot convert to type `%s`" thrown in apache/shardingsphere.

Source

Thrown at infra/common/src/main/java/org/apache/shardingsphere/infra/props/TypedPropertyValue.java:46

 */
@Getter
public final class TypedPropertyValue {
    
    private final Object value;
    
    public TypedPropertyValue(final TypedPropertyKey key, final String value) throws TypedPropertyValueException {
        this.value = createTypedValue(key, value);
    }
    
    private Object createTypedValue(final TypedPropertyKey key, final String value) throws TypedPropertyValueException {
        if (boolean.class == key.getType() || Boolean.class == key.getType()) {
            return Boolean.valueOf(value);
        }
        if (int.class == key.getType() || Integer.class == key.getType()) {
            try {
                return Integer.valueOf(value);
            } catch (final NumberFormatException ignored) {
                throw new TypedPropertyValueException(key, value);
            }
        }
        if (long.class == key.getType() || Long.class == key.getType()) {
            try {
                return Long.valueOf(value);
            } catch (final NumberFormatException ignored) {
                throw new TypedPropertyValueException(key, value);
            }
        }
        if (float.class == key.getType() || Float.class == key.getType()) {
            try {
                return Float.valueOf(value);
            } catch (final NumberFormatException ignored) {
                throw new TypedPropertyValueException(key, value);
            }
        }
        if (double.class == key.getType() || Double.class == key.getType()) {
            try {

View on GitHub (pinned to e952770a21)

Solutions

  1. Check the property key's expected type and provide a value of that type.
  2. Remove surrounding whitespace or quotes that prevent the value from being parsed.
  3. Consult the documentation for the valid value range or format of the property.

When it happens

Trigger: A ShardingSphere property value cannot be converted to the typed value declared for its key in TypedPropertyValue.

Common situations: Non-numeric text given for an integer property, or an unrecognized literal for a boolean property in the configuration.


AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14). Data as JSON: /api/errors/61c0796ef446d57a. Report an issue: GitHub.