apache/cassandra · error · InvalidTypeException

Cannot parse UDT value from

Error message

Cannot parse UDT value from "%s", at character %d expecting '{' but got '%c'

What it means

InvalidTypeException from UDTCodec.parse: the UDT literal does not start with '{' after leading spaces (or is otherwise not brace-delimited). It is the first syntax guard of the parser, checked immediately after the null/NULL/empty short-circuit.

Solutions

  1. Wrap the UDT literal in braces: {field: value, ...}
  2. Quote field names that contain special characters
  3. Ensure no stray prefix (e.g. a copy-pasted alias) precedes the opening brace
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/java/org/apache/cassandra/cql3/functions/types/TypeCodec.java:2655 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/aa03dc1ea6e00000. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/cql3/functions/types/TypeCodec.java:2655

                sb.append(Metadata.quoteIfNecessary(field.getName()));
                sb.append(':');
                sb.append(formatField(value, Metadata.quoteIfNecessary(field.getName())));
                i += 1;
            }
            sb.append('}');
            return sb.toString();
        }

        @Override
        public T parse(String value)
        {
            if (value == null || value.isEmpty() || value.equals("NULL")) return null;

            T v = newInstance();

            int idx = ParseUtils.skipSpaces(value, 0);
            if (value.charAt(idx++) != '{')
                throw new InvalidTypeException(
                String.format(
                "Cannot parse UDT value from \"%s\", at character %d expecting '{' but got '%c'",
                value, idx, value.charAt(idx)));

            idx = ParseUtils.skipSpaces(value, idx);

            if (value.charAt(idx) == '}') return v;

            while (idx < value.length())
            {

                int n;
                try
                {
                    n = ParseUtils.skipCQLId(value, idx);
                }
                catch (IllegalArgumentException e)
                {

View on GitHub (pinned to 88fd0f6a0e)