{"record":{"id":"2d7dbe78eb9034ae","repo":"pinpoint-apm/pinpoint","slug":"injectfield-error-field-field-value-value","errorCode":null,"errorMessage":"injectField error field:<field> value:<value>","messagePattern":"injectField error field:<field> value:<value>","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"commons-config/src/main/java/com/navercorp/pinpoint/common/config/util/ValueAnnotationProcessor.java","lineNumber":194,"sourceCode":"        }\n        return value.charAt(0);\n    }\n\n    private void injectField(Field field, Object target, String value) {\n        final Class<?> fieldType = field.getType();\n\n        try {\n            final Object parsedValue = parse(fieldType, value);\n            if (parsedValue != null) {\n                try {\n                    setAccessible(field);\n                    field.set(target, parsedValue);\n                } catch (ReflectiveOperationException e) {\n                    throw new ConfigurationException(getFieldName(target, field) + \" access error\", e);\n                }\n            }\n        } catch (Exception ex) {\n            throw new RuntimeException(\"injectField error field:\" + field + \" value:\" + value, ex);\n        }\n    }\n\n    private String getFieldName(Object instance, Member field) {\n        return instance.getClass().getSimpleName() + \".\" + field.getName();\n    }\n\n}\n","sourceCodeStart":176,"sourceCodeEnd":203,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons-config/src/main/java/com/navercorp/pinpoint/common/config/util/ValueAnnotationProcessor.java#L176-L203","documentation":"injectField() wraps its entire body (parse + field.set) in a catch-all that rethrows RuntimeException('injectField error field:<field> value:<value>', cause). So any failure during value parsing (NumberFormatException, the Unsupported type ConfigurationException from parse(), the single-char check) or injection surfaces with this message, preserving the field name and raw value for diagnosis.","triggerScenarios":"Any parse/inject failure inside injectField: non-numeric string for an int/long field, number out of range (e.g. value 99999 for byte), invalid enum constant name, unsupported field type, or reflection access failure — all get this wrapper message.","commonSituations":"Typo in a config value ('tuer' for boolean works, but 'port=abc' for int does not); enum constant renamed so old config value no longer matches; property value out of the numeric type's range; field type changed in a release while the config file still holds the old value format.","solutions":["Read the 'cause' chained exception to see the real failure (parse error vs access error)","Correct the property value in the config file to match the field type (numeric, valid enum constant name, etc.)","If the type changed in an upgrade, migrate the config key/value to the new expected type","Avoid static/final annotated fields so injection does not fail"],"exampleFix":"// before (config)\nserver.port=abc\n// after (config)\nserver.port=18080","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    processor.process(configInstance, resolver);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"injectField error\")) {\n        log.error(\"Config field injection failed: {} | cause: {}\", e.getMessage(), e.getCause());\n    }\n}","preventionTips":["Always inspect the cause chain — the real reason (NumberFormatException, invalid enum name) is wrapped","Validate config values (numeric ranges, enum names) before loading them into config objects","Write startup smoke tests that load all config classes from a sample properties file","Keep field types stable across releases or document config migrations"],"tags":["java","reflection","configuration","parse-error"],"backgroundTag":"invalid-config-value","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}