pinpoint-apm/pinpoint · error · IllegalArgumentException

Invalid value:<value>

Error message

Invalid value:<value>

What it means

When parse() encounters a char/Character target it delegates to parseChar(), which requires the resolved property string to be exactly one character long. Any other length throws IllegalArgumentException (wrapped later by injectField into RuntimeException). This is a strict single-character value validation.

Source

Thrown at commons-config/src/main/java/com/navercorp/pinpoint/common/config/util/ValueAnnotationProcessor.java:175

        } else if (type == boolean.class || type == Boolean.class) {
            return Boolean.parseBoolean(value);
        } else if (type == double.class || type == Double.class) {
            return Double.parseDouble(value);
        } else if (type == float.class || type == Float.class) {
            return Float.parseFloat(value);
        } else if (type == short.class || type == Short.class) {
            return Short.parseShort(value);
        } else if (type == byte.class || type == Byte.class) {
            return Byte.parseByte(value);
        } else if (type == char.class || type == Character.class) {
            return parseChar(value);
        }
        throw new ConfigurationException("Unsupported type:" + type.getName());
    }

    private char parseChar(String value) {
        if (value.length() != 1) {
            throw new IllegalArgumentException("Invalid value:" + value);
        }
        return value.charAt(0);
    }

    private void injectField(Field field, Object target, String value) {
        final Class<?> fieldType = field.getType();

        try {
            final Object parsedValue = parse(fieldType, value);
            if (parsedValue != null) {
                try {
                    setAccessible(field);
                    field.set(target, parsedValue);
                } catch (ReflectiveOperationException e) {
                    throw new ConfigurationException(getFieldName(target, field) + " access error", e);
                }
            }
        } catch (Exception ex) {

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Set the config value to exactly one character, trimming surrounding whitespace
  2. Add a default in the placeholder, e.g. ${key:|} style defaults, so resolution never yields empty
  3. Change the field type to String if the value can legitimately be longer than one character

Example fix

// before (config)
separator=;;
// after (config)
separator=;
Defensive patterns

Strategy: validation

Validate before calling

if (value == null || value.trim().length() != 1) {
    throw new IllegalStateException("char property must be exactly one character, got: '" + value + "'");
}

Try / catch

try {
    processor.process(configInstance, resolver);
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().contains("Invalid value:")) {
        log.error("char config value must be a single character");
    }
}

Prevention

When it happens

Trigger: A @Value-annotated char/Character field or setter receives a property value whose string length is not 1, e.g. an empty string, a multi-character word, or a value with trailing whitespace/newline from the config file.

Common situations: Config file contains 'separator=;;' or 'mode=abc' for a char field; property value has invisible trailing whitespace or a CRLF; placeholder resolution produced an empty string because the key was missing a default.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/a0cf5383573f9049. Report an issue: GitHub.