apache/cassandra · error · InvalidRequestException

Field ' ' doesn't exist in type ' .

Error message

Field '%s' doesn't exist in type '%s.%s'

What it means

validateAndGetTypeField checks that a named field exists within a user-defined type by calling type.fieldPosition(fieldName). A return value of -1 means the UDT has no such field, so the statement is rejected with this InvalidRequestException.

Solutions

  1. Verify the field list: SELECT field_names FROM system_schema.types WHERE keyspace_name='<ks>' AND type_name='<type>';
  2. Correct the field identifier spelling/case to match the UDT definition.
  3. Add the missing field via ALTER TYPE <ks>.<type> ADD <field> <ctype>; if it is genuinely needed.

Example fix

// before
ALTER ... FIELD emial ... (on type customer_type)
// after
ALTER ... FIELD email ...
Defensive patterns

Strategy: validation

Validate before calling

SELECT field_names FROM system_schema.types WHERE keyspace_name='myks' AND type_name='mytype'; // verify field is present before targeting it

Prevention

When it happens

Trigger: Issuing a statement that targets a specific field of a UDT (e.g. security labels on a type field) where the field name does not match any field of the resolved UserType.

Common situations: Typos or wrong casing in field identifiers; UDT was altered and the field renamed/removed; assuming fields from a different UDT in the same keyspace.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/cql3/statements/schema/SchemaDescriptionStatement.java:114

    protected UserType validateAndGetType(Keyspaces schema, String typeName)
    {
        KeyspaceMetadata keyspaceMetadata = validateAndGetKeyspace(schema);

        UserType type = keyspaceMetadata.types.getNullable(bytes(typeName));
        if (null == type)
            throw ire("Type '%s.%s' doesn't exist", keyspaceName, typeName);

        return type;
    }

    protected UserType validateAndGetTypeField(Keyspaces schema,
                                               String typeName,
                                               FieldIdentifier fieldName)
    {
        UserType type = validateAndGetType(schema, typeName);

        if (type.fieldPosition(fieldName) == -1)
            throw ire("Field '%s' doesn't exist in type '%s.%s'", fieldName, keyspaceName, typeName);

        return type;
    }

    protected String effectiveDescription()
    {
        return description == null ? NO_DESCRIPTION : description;
    }

    protected void providerWarning(String provider)
    {
        if (provider != null)
            ClientWarn.instance.warn("Provider functionality not implemented." +
                                     " Provider '" + provider + "' will not be loaded or invoked.");
    }

    protected enum DescriptionType
    {

View on GitHub (pinned to 88fd0f6a0e)