apache/druid · error · IllegalArgumentException

Value [%s] is not valid for property [%s]

Error message

Value [%s] is not valid for property [%s]

What it means

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.

Source

Thrown at server/src/main/java/org/apache/druid/catalog/model/ModelProperties.java:171

     * Validate that the given value is valid for this property.
     * By default, does a value conversion and discards the value.
     */
    @Override
    public void validate(Object value, ObjectMapper jsonMapper)
    {
      decode(value, jsonMapper);
    }

    public T decodeJson(String value, ObjectMapper jsonMapper)
    {
      if (value == null) {
        return null;
      }
      try {
        return jsonMapper.readValue(value, valueClass);
      }
      catch (Exception e) {
        throw new IAE(
            "Value [%s] is not valid for property [%s]",
            value,
            name
        );
      }
    }
  }


  class ObjectPropertyDefn<T> extends BasePropertyDefn<T>
  {
    public final Class<T> valueClass;

    public ObjectPropertyDefn(
        final String name,
        final Class<T> valueClass
    )
    {

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Fix the JSON string so it parses: valid JSON requires double-quoted keys/strings, no trailing commas.
  2. Validate the string with a JSON parser or the equivalent convertValue path before submitting.
  3. If the surrounding system lets you pass native structures instead of strings, prefer decode/convertValue to avoid double encoding.

Example fix

// before
{"properties": {"filter": "{type: 'selector', column: 'x'}"}}
// after
{"properties": {"filter": "{\"type\":\"selector\",\"column\":\"x\"}"}}
Defensive patterns

Strategy: validation

Validate before calling

try {
  mapper.readTree(jsonString); // parse check only
} catch (JsonProcessingException e) {
  throw new IllegalArgumentException("Property value is not valid JSON: " + e.getOriginalMessage());
}

Type guard

boolean isValidJson(String s) {
  try { jsonMapper.readTree(s); return true; } catch (Exception e) { return false; }
}

Try / catch

try { Object v = propDef.decodeJson(mapper, jsonString); } catch (IllegalArgumentException e) { log.error("Bad JSON for property: %s", e.getMessage()); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/5985587bd048a418. Report an issue: GitHub.