{"record":{"id":"973071b7c713a2a2","repo":"apache/cassandra","slug":"e-getmessage","errorCode":null,"errorMessage":"e.getMessage()","messagePattern":"e\\.getMessage\\(\\)","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/terms/Constants.java","lineNumber":320,"sourceCode":"        private ByteBuffer parsedValue(AbstractType<?> validator) throws InvalidRequestException\n        {\n            if (validator instanceof ReversedType<?>)\n                validator = ((ReversedType<?>) validator).baseType;\n            try\n            {\n                if (type == Type.HEX)\n                    // Note that validator could be BytesType, but it could also be a custom type, so\n                    // we hardcode BytesType (rather than using 'validator') in the call below.\n                    // Further note that BytesType doesn't want it's input prefixed by '0x', hence the substring.\n                    return BytesType.instance.fromString(text.substring(2));\n\n                if (validator instanceof CounterColumnType)\n                    return LongType.instance.fromString(text);\n                return validator.fromString(text);\n            }\n            catch (MarshalException e)\n            {\n                throw new InvalidRequestException(e.getMessage());\n            }\n        }\n\n        @Override\n        public AssignmentTestable.TestResult testAssignment(String keyspace, ColumnSpecification receiver)\n        {\n            CQL3Type receiverType = receiver.type.asCQL3Type();\n            if (receiverType.isCollection() || receiverType.isUDT() || receiverType.isVector())\n                return AssignmentTestable.TestResult.NOT_ASSIGNABLE;\n\n            if (!(receiverType instanceof CQL3Type.Native))\n                // Skip type validation for custom types. May or may not be a good idea\n                return AssignmentTestable.TestResult.WEAKLY_ASSIGNABLE;\n\n            CQL3Type.Native nt = (CQL3Type.Native)receiverType;\n\n            // If the receiver type match the prefered type we can straight away return an exact match\n            if (nt.getType().equals(preferedType))","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/terms/Constants.java#L302-L338","documentation":"Wraps a MarshalException raised when the type's fromString() parser rejects the literal text during parsedValue(). The message is the marshal error text, e.g. 'Unable to make int from \"abc\"'. It means the constant's format is not valid for the target type.","triggerScenarios":"`INSERT ... VALUES (0, 'not-a-number')` for an int column; malformed uuid, date, inet, or blob (non-hex) literals reaching type.fromString().","commonSituations":"Typos in numeric/UUID/date literals; locale-formatted numbers ('1,000'); users pasting formatted dates unsupported by CQL (must be ISO-8601 or epoch millis); blobs given without 0x prefix.","solutions":["Fix the literal to the canonical CQL format for the column type (int: digits; uuid: 8-4-4-4-12 hex; blob: 0x hex; timestamp: ISO-8601)","Use bound parameters and let the driver serialize typed values instead of string literals","Read the embedded marshal message to see which type and text failed"],"exampleFix":"// before\nINSERT INTO t (k, ts) VALUES (0, '01/02/2024'); // unsupported format\n// after\nINSERT INTO t (k, ts) VALUES (0, '2024-01-02T00:00:00+0000');","handlingStrategy":"validation","validationCode":"try { targetCqlTypeFromString(text); } catch (Exception e) { throw new IllegalArgumentException(\"bad literal: \" + text); }","typeGuard":null,"tryCatchPattern":"try { session.execute(query); } catch (InvalidQueryException e) { /* message carries the MarshalException text; log text + expected type */ }","preventionTips":["Use canonical CQL literal formats (ISO-8601 timestamps, unquoted uuids, 0x blobs)","Prefer bound parameters over string literals","Avoid locale-formatted numbers/dates in CQL text"],"tags":["cql","parse-error","marshal","format"],"backgroundTag":"invalid-argument-format","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}