{"record":{"id":"ec6debe08673cc1d","repo":"quarkusio/quarkus","slug":"runtimeexception-e-ec6deb","errorCode":null,"errorMessage":"RuntimeException(e)","messagePattern":"RuntimeException\\(e\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/funqy/funqy-server-common/runtime/src/main/java/io/quarkus/funqy/runtime/query/QueryObjectReader.java","lineNumber":24,"sourceCode":"import java.util.HashMap;\nimport java.util.Map;\nimport java.util.function.Function;\n\n/**\n * Turn URI parameter map into an object\n *\n */\nclass QueryObjectReader extends BaseObjectReader {\n\n    Map<String, ValueSetter> properties = new HashMap<>();\n    Class clz;\n\n    @Override\n    public Object create() {\n        try {\n            return clz.getDeclaredConstructor().newInstance();\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    QueryObjectReader(Class clz, QueryObjectMapper mapper) {\n        this.clz = clz;\n        for (Method m : clz.getMethods()) {\n            if (!isSetter(m))\n                continue;\n            Class paramType = m.getParameterTypes()[0];\n            Type paramGenericType = m.getGenericParameterTypes()[0];\n            final Function<String, Object> extractor = mapper.extractor(paramType);\n\n            String name;\n            if (m.getName().length() > 4) {\n                name = Character.toLowerCase(m.getName().charAt(3)) + m.getName().substring(4);\n            } else {\n                name = m.getName().substring(3).toLowerCase();\n            }","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/funqy/funqy-server-common/runtime/src/main/java/io/quarkus/funqy/runtime/query/QueryObjectReader.java#L6-L42","documentation":"QueryObjectReader.create() instantiates the target POJO via its no-arg constructor using reflection. Any failure (missing no-arg constructor, constructor throwing, access violation) is wrapped in a RuntimeException. Inspect the cause for the actual problem.","triggerScenarios":"A @Funq query function parameter POJO without a public no-argument constructor, or whose constructor throws (e.g. validation in constructor).","commonSituations":"Defining immutable POJOs with only builder/args constructors for query binding; constructor performing IO or validation that fails; inner non-static classes lacking no-arg constructors.","solutions":["Add a public no-argument constructor to the parameter POJO","Move validation/initialization logic out of the constructor into setters or the function body","Make inner classes static or top-level","Use the query parameter binding-friendly mutable POJO pattern"],"exampleFix":"// before\npublic class Params {\n    public Params(String name) { this.name = name; } // no no-arg ctor\n}\n// after\npublic class Params {\n    public Params() {}\n    public void setName(String name) { this.name = name; }\n}","handlingStrategy":"validation","validationCode":"// Verify POJO has a public no-arg constructor before binding\nstatic void assertInstantiable(Class<?> clz) {\n    try {\n        clz.getDeclaredConstructor().setAccessible(true);\n    } catch (NoSuchMethodException e) {\n        throw new IllegalArgumentException(clz + \" needs a public no-arg constructor\");\n    }\n}","typeGuard":"static boolean hasNoArgConstructor(Class<?> clz) {\n    try { clz.getDeclaredConstructor(); return true; }\n    catch (NoSuchMethodException e) { return false; }\n}","tryCatchPattern":"try {\n    Object pojo = reader.create();\n} catch (RuntimeException e) {\n    Throwable cause = e.getCause();\n    if (cause instanceof InstantiationException || cause instanceof NoSuchMethodException)\n        log.errorf(\"Add a public no-arg constructor to %s\", clz.getName());\n    throw e;\n}","preventionTips":["Always give query-binding POJOs a public no-arg constructor","Keep constructors side-effect free (no validation/IO)","Make nested classes static so they retain default constructors","Prefer setter-based population for query-bound parameters"],"tags":["quarkus","funqy","reflection","instantiation"],"backgroundTag":"missing-no-arg-constructor","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}