{"record":{"id":"4428442eddeda57b","repo":"apache/druid","slug":"value-s-is-not-valid-for-property-s-expecte-442844","errorCode":null,"errorMessage":"Value [%s] is not valid for property [%s], expected %s","messagePattern":"Value \\[(.+?)\\] is not valid for property \\[(.+?)\\], expected (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/catalog/model/ModelProperties.java","lineNumber":143,"sourceCode":"    }\n\n    /**\n     * Convert the value from the deserialized JSON format to the type\n     * required by this field data type. Also used to decode values from\n     * SQL parameters. As a side effect, verifies that the value is of\n     * the correct type.\n     */\n    @Override\n    public T decode(Object value, ObjectMapper jsonMapper)\n    {\n      if (value == null) {\n        return null;\n      }\n      try {\n        return jsonMapper.convertValue(value, valueClass);\n      }\n      catch (Exception e) {\n        throw new IAE(\n            \"Value [%s] is not valid for property [%s], expected %s\",\n            value,\n            name,\n            typeName()\n        );\n      }\n    }\n\n    /**\n     * Validate that the given value is valid for this property.\n     * By default, does a value conversion and discards the value.\n     */\n    @Override\n    public void validate(Object value, ObjectMapper jsonMapper)\n    {\n      decode(value, jsonMapper);\n    }\n","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/catalog/model/ModelProperties.java#L125-L161","documentation":"ModelProperties.decode converts a raw property value into the declared Java type using Jackson's convertValue. When the conversion fails — the value's shape or type does not match the property's declared type — this IAE is thrown with the property name and expected type name.","triggerScenarios":"Supplying a property value whose type mismatches the model definition: e.g. a string where an integer/map/list is declared, an object where a scalar is expected. jsonMapper.convertValue throws and decode wraps it as IAE.","commonSituations":"JSON/YAML config where a property is written as a string (\"replicas\": \"3\") while the model declares an integer; nested map properties given as flat strings; type drift after a model definition change or upgrade.","solutions":["Match the value to the expected type named in the message (typeName() output), e.g. supply a JSON object instead of a string.","Remove surrounding quotes from numeric/boolean values in the config.","Check the model definition (ModelProperties) to confirm the declared type, and if the model is wrong, correct the property's declared type."],"exampleFix":"// before\n{\"properties\": {\"replicas\": \"3\"}}\n// after\n{\"properties\": {\"replicas\": 3}}","handlingStrategy":"validation","validationCode":"// ensure value's JSON type matches the declared property type before submit\nObject v = props.get(name);\nif (expectedType == Integer.class && !(v instanceof Number)) {\n  throw new IllegalArgumentException(name + \" must be an integer\");\n}","typeGuard":"boolean matchesExpectedType(Object v, Class<?> expected) {\n  return v == null || expected.isInstance(v)\n      || (expected == Integer.class && v instanceof Number);\n}","tryCatchPattern":"try { Object decoded = propDef.decode(mapper, rawValue); } catch (IllegalArgumentException e) { log.error(\"Property type error: %s\", e.getMessage()); }","preventionTips":["Unquote numeric and boolean values in JSON/YAML configs.","Consult the model definition for each property's declared type before writing config.","Re-validate stored specs after model definition or version changes."],"tags":["catalog","property","type-mismatch","jackson"],"backgroundTag":"invalid-argument-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}