{"record":{"id":"5985587bd048a418","repo":"apache/druid","slug":"value-s-is-not-valid-for-property-s","errorCode":null,"errorMessage":"Value [%s] is not valid for property [%s]","messagePattern":"Value \\[(.+?)\\] is not valid for property \\[(.+?)\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/catalog/model/ModelProperties.java","lineNumber":171,"sourceCode":"     * 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\n    public T decodeJson(String value, ObjectMapper jsonMapper)\n    {\n      if (value == null) {\n        return null;\n      }\n      try {\n        return jsonMapper.readValue(value, valueClass);\n      }\n      catch (Exception e) {\n        throw new IAE(\n            \"Value [%s] is not valid for property [%s]\",\n            value,\n            name\n        );\n      }\n    }\n  }\n\n\n  class ObjectPropertyDefn<T> extends BasePropertyDefn<T>\n  {\n    public final Class<T> valueClass;\n\n    public ObjectPropertyDefn(\n        final String name,\n        final Class<T> valueClass\n    )\n    {","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/catalog/model/ModelProperties.java#L153-L189","documentation":"ModelProperties.decodeJson parses a property value that is provided as a JSON string via Jackson readValue into the declared type. If the string is not valid JSON, or valid JSON of the wrong shape, this IAE is thrown naming the property.","triggerScenarios":"Calling decodeJson with a value string that is malformed JSON (missing quotes, trailing commas, single quotes) or whose structure does not fit valueClass — e.g. \"[1,2\" or \"{a:1}\" without quoted keys.","commonSituations":"Users hand-edit serialized JSON properties in specs and introduce syntax errors; single-quoted or unquoted JSON copied from JavaScript; shell escaping stripped double quotes before the string reached Druid.","solutions":["Fix the JSON string so it parses: valid JSON requires double-quoted keys/strings, no trailing commas.","Validate the string with a JSON parser or the equivalent convertValue path before submitting.","If the surrounding system lets you pass native structures instead of strings, prefer decode/convertValue to avoid double encoding."],"exampleFix":"// before\n{\"properties\": {\"filter\": \"{type: 'selector', column: 'x'}\"}}\n// after\n{\"properties\": {\"filter\": \"{\\\"type\\\":\\\"selector\\\",\\\"column\\\":\\\"x\\\"}\"}}","handlingStrategy":"validation","validationCode":"try {\n  mapper.readTree(jsonString); // parse check only\n} catch (JsonProcessingException e) {\n  throw new IllegalArgumentException(\"Property value is not valid JSON: \" + e.getOriginalMessage());\n}","typeGuard":"boolean isValidJson(String s) {\n  try { jsonMapper.readTree(s); return true; } catch (Exception e) { return false; }\n}","tryCatchPattern":"try { Object v = propDef.decodeJson(mapper, jsonString); } catch (IllegalArgumentException e) { log.error(\"Bad JSON for property: %s\", e.getMessage()); }","preventionTips":["Validate JSON strings with a parser before embedding them in specs.","Use double quotes only; no single quotes, unquoted keys, or trailing commas.","Pass native structures instead of serialized strings when the API allows it."],"tags":["catalog","json","parsing","property"],"backgroundTag":"json-parse-error","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"}