{"record":{"id":"5531a1cf7e9da813","repo":"oracle/graal","slug":"failed-to-parse-experiment-experimentid-in-reso-5531a1","errorCode":null,"errorMessage":"Failed to parse experiment {experimentId} in {resource}: expected {objectName} to be an instance of {expectedType} but got \"{actualObject}\"","messagePattern":"Failed to parse experiment (.+?) in (.+?): expected (.+?) to be an instance of (.+?) but got \"(.+?)\"","errorType":"exception","errorClass":"ExperimentParserTypeError","httpStatus":null,"severity":"error","filePath":"compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/parser/ExperimentJSONParser.java","lineNumber":72,"sourceCode":"         */\n        private final Object object;\n\n        /**\n         * The name of the literal.\n         */\n        private final String objectName;\n\n        private JSONLiteral(Object object, String objectName) {\n            this.object = object;\n            this.objectName = objectName;\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        private <T> T asInstanceOf(Class<T> clazz) throws ExperimentParserTypeError {\n            if (clazz.isInstance(object)) {\n                return (T) object;\n            }\n            throw new ExperimentParserTypeError(experimentId, file.getSymbolicPath(), objectName, clazz, object);\n        }\n\n        private <T> T asNullableInstanceOf(Class<T> clazz) throws ExperimentParserTypeError {\n            if (object == null) {\n                return null;\n            }\n            return asInstanceOf(clazz);\n        }\n\n        public boolean isNull() {\n            return object == null;\n        }\n\n        public String asString() throws ExperimentParserTypeError {\n            return asInstanceOf(String.class);\n        }\n\n        public boolean asBoolean() throws ExperimentParserTypeError {","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/parser/ExperimentJSONParser.java#L54-L90","documentation":"The central type-narrowing check of ExperimentJSONParser: JSONLiteral.asInstanceOf(clazz) throws ExperimentParserTypeError when the decoded JSON value is not of the requested Java type. Every asInt/asString/asMap/asList/asLong/asBoolean call on log JSON funnels through it, so any schema mismatch in a proftool or optimization-log JSON surfaces here with the experiment id, symbolic file path, offending property name, expected type, and actual value.","triggerScenarios":"A proftool JSON where 'total_period' is a string, an optimization tree node whose 'name' is a number, a list property holding an object, etc. — any asX() accessor invoked on a JSON literal of a different type.","commonSituations":"Mixing proftool/optimization logs from a GraalVM version whose JSON schema differs from the profdiff version parsing them; hand-modified logs; third-party tools writing the log fields with different types.","solutions":["Use a proftool output and optimization logs generated by the same GraalVM build as the profdiff you run.","Inspect the reported {resource}/{objectName} in the JSON and make its type match the schema (integers unquoted, maps as objects, arrays as arrays).","Regenerate the experiment data rather than patching JSON by hand."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Lightweight schema check before full parsing\nObject totalPeriod = proftoolMap.get(\"total_period\");\nif (!(totalPeriod instanceof Number)) throw new IllegalStateException(\"total_period must be numeric\");","typeGuard":null,"tryCatchPattern":"try {\n    new ExperimentJSONParser(experimentId, fileView).parse();\n} catch (ExperimentParserTypeError e) {\n    // message: experiment, resource, property, expected vs actual type; fix that JSON field\n}","preventionTips":["Generate and parse logs with the same GraalVM version.","Do not edit JSON logs with tools that retype values (quoting numbers)."],"tags":["profdiff","json","type-mismatch","parser"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}