{"record":{"id":"d047d57dfe4779ee","repo":"FasterXML/jackson-databind","slug":"cannot-call-createparameterobject-on","errorCode":null,"errorMessage":"Cannot call createParameterObject() on {}","messagePattern":"Cannot call createParameterObject\\(\\) on (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/main/java/tools/jackson/databind/deser/SettableAnyProperty.java","lineNumber":177,"sourceCode":"     *\n     * @since 2.18.1\n     */\n    public boolean isFieldType() { return _setterIsField; }\n\n    /**\n     * Method called to check whether this property is method\n     *\n     * @return 2.18.2\n     */\n    public boolean isSetterType() { return _setter instanceof AnnotatedMethod; }\n\n    /**\n     * Create an instance of value to pass through Creator parameter.\n     *\n     * @since 2.18\n     */\n    public Object createParameterObject() {\n        throw new UnsupportedOperationException(\"Cannot call createParameterObject() on \" + getClass().getName());\n    }\n\n    /*\n    /**********************************************************************\n    /* Public API, deserialization\n    /**********************************************************************\n     */\n\n    /**\n     * Method called to deserialize appropriate value, given parser (and\n     * context), and set it using appropriate method (a setter method).\n     */\n    public void deserializeAndSet(JsonParser p, DeserializationContext ctxt,\n            Object instance, String propName)\n        throws JacksonException\n    {\n        try {\n            Object key = (_keyDeserializer == null) ? propName","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/FasterXML/jackson-databind/blob/a50c7d2a1d57234ac4adf70dbd88ac90db6436e4/src/main/java/tools/jackson/databind/deser/SettableAnyProperty.java#L159-L195","documentation":"Thrown by the base SettableAnyProperty.createParameterObject() — the default implementation is unsupported because field/method-based any-setters have no 'parameter object' to create. Only the creator-parameter-based subclass (a Map-typed @JsonAnySetter used as a @JsonCreator argument) supports it; calling it on any other variant throws UnsupportedOperationException.","triggerScenarios":"A bean declares @JsonAnySetter on a field or a single-arg setter method (NOT a creator Map parameter), and the deserialization path or a direct caller invokes createParameterObject(). Usually surfaces as an internal mismatch when @JsonAnySetter is combined with @JsonCreator in an incompatible way.","commonSituations":"Mixing field/method @JsonAnySetter with a @JsonCreator whose signature implies a collect-any Map that doesn't exist; upgrading Jackson where any-setter/creator resolution changed; calling the API directly from custom deserialization code without checking the any-setter form.","solutions":["If you need a creator-parameter any-setter, declare @JsonAnySetter on a Map-typed parameter of a @JsonCreator constructor/factory (the supported creator form).","If using field/method @JsonAnySetter, don't rely on createParameterObject(); ensure the deserializer uses the per-key deserializeAndSet path.","Remove the conflicting @JsonCreator or realign it with the any-setter shape.","Avoid calling createParameterObject() from custom code unless you've confirmed the variant via isFieldType()/isSetterType()."],"exampleFix":"// before: field-based any-setter combined with a creator expecting a map -> mismatch\nclass Bag {\n    private Map<String,Object> props = new HashMap<>();\n    @JsonAnySetter public void add(String k, Object v){ props.put(k, v); }\n    @JsonCreator public Bag(@JsonProperty(\"props\") Map<String,Object> p){ ... }\n}\n// after: any-setter as a creator parameter (supported form)\nclass Bag {\n    private final Map<String,Object> props;\n    @JsonCreator public Bag(@JsonAnySetter Map<String,Object> props){ this.props = props; }\n}","handlingStrategy":"validation","validationCode":"if (anyProperty.isFieldType() || anyProperty.isSetterType()) {\n    // field/method form: createParameterObject() is unsupported\n    throw new UnsupportedOperationException(\n        \"createParameterObject() only valid for creator-parameter any-setters\");\n}\nObject paramObj = anyProperty.createParameterObject();","typeGuard":null,"tryCatchPattern":"try {\n    return anyProperty.createParameterObject();\n} catch (UnsupportedOperationException e) {\n    // any-setter is field/method form; fall back to per-key deserializeAndSet\n    return null;\n}","preventionTips":["Keep @JsonAnySetter and @JsonCreator consistent: creator-parameter form (Map arg) OR field/method form — not mixed.","Don't call createParameterObject() on field/method any-setters; use deserializeAndSet per key.","When upgrading Jackson, re-test types that combine @JsonAnySetter with @JsonCreator."],"tags":["jsonanysetter","deserialization","creator","unsupported-operation"],"analyzedSha":"a50c7d2a1d57234ac4adf70dbd88ac90db6436e4","analyzedAt":"2026-08-06T20:31:51.404Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}