{"record":{"id":"534cc55f600cfff1","repo":"prestodb/presto","slug":"jsonmappingexception-cause-message","errorCode":null,"errorMessage":"(JsonMappingException cause message)","messagePattern":"\\(JsonMappingException cause message\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-file-session-property-manager/src/main/java/com/facebook/presto/session/file/FileSessionPropertyManager.java","lineNumber":72,"sourceCode":"        catch (IOException e) {\n            throw new UncheckedIOException(e);\n        }\n        catch (IllegalArgumentException e) {\n            Throwable cause = e.getCause();\n            if (cause instanceof UnrecognizedPropertyException) {\n                UnrecognizedPropertyException ex = (UnrecognizedPropertyException) cause;\n                String message = format(\"Unknown property at line %s:%s: %s\",\n                        ex.getLocation().getLineNr(),\n                        ex.getLocation().getColumnNr(),\n                        ex.getPropertyName());\n                throw new IllegalArgumentException(message, e);\n            }\n            if (cause instanceof JsonMappingException) {\n                // remove the extra \"through reference chain\" message\n                if (cause.getCause() != null) {\n                    cause = cause.getCause();\n                }\n                throw new IllegalArgumentException(cause.getMessage(), e);\n            }\n            throw e;\n        }\n    }\n\n    @Override\n    protected List<SessionMatchSpec> getSessionMatchSpecs()\n    {\n        return sessionMatchSpecs;\n    }\n}\n","sourceCodeStart":54,"sourceCodeEnd":84,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-file-session-property-manager/src/main/java/com/facebook/presto/session/file/FileSessionPropertyManager.java#L54-L84","documentation":"FileSessionPropertyManager wraps Jackson's JsonMappingException (other than unrecognized-property cases) when parsing the session properties JSON file. The underlying cause message (with the 'through reference chain' noise stripped) is rethrown as an IllegalArgumentException. It signals the JSON is structurally invalid for the target type: wrong value types, invalid enum values, etc.","triggerScenarios":"A config file whose JSON is syntactically valid but fails binding: e.g. a string where a number/boolean is expected, an invalid enum value for a property, or nested structure mismatch.","commonSituations":"Hand-edited config files with wrong value types (\"true\" as string vs boolean); values like \"1h\" for a property expecting a plain number or data size; config generated by tooling after schema changes.","solutions":["Read the cause message to find the offending property and fix its value/type in the config file","Validate the JSON against the expected session property types (booleans, sizes, durations as correct types)","Regenerate or simplify the config file to a known-good baseline and add properties incrementally"],"exampleFix":"// before\n{\"query_max_run_time\": \"100m\"}   // expects a duration string? type error if class expects long\n// after (match declared type)\n{\"query_max_run_time\": \"100m\"}  // verify against the @Config-annotated field's expected type","handlingStrategy":"validation","validationCode":"// Pre-validate JSON structure and value types against the expected schema\ntry (InputStream in = new FileInputStream(configFile)) {\n  JsonNode root = mapper.readTree(in);\n  root.fields().forEachRemaining(e -> checkType(e.getKey(), e.getValue()));\n}","typeGuard":"boolean hasExpectedType(JsonNode node, Class<?> expected) {\n  if (expected == boolean.class) return node.isBoolean();\n  if (expected == long.class) return node.canConvertToLong();\n  if (expected == String.class) return node.isTextual();\n  return false;\n}","tryCatchPattern":"try { manager = new FileSessionPropertyManager(configFile); }\ncatch (IllegalArgumentException e) {\n  Throwable root = e; while (root.getCause() != null) root = root.getCause();\n  log.error(\"Config binding failed: \" + root.getMessage());\n  throw e;\n}","preventionTips":["Match JSON value types exactly to @Config-annotated field types (boolean vs string vs number)","Keep a schema/JSON example of the config in the repo and lint against it","Change config in small increments and restart-check after each change"],"tags":["json","config","jackson","deserialization"],"backgroundTag":"config-deserialization-failed","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}