prestodb/presto · error · PrestoException

THRIFT_SERVICE_INVALID_RESPONSE

THRIFT_SERVICE_INVALID_RESPONSE

Error message

Requested and actual table names are different

What it means

ThriftMetadata.getTableMetadataInternal fetches table metadata from the external Thrift service and cross-checks that the returned table's schema/name matches what was requested. A mismatch means the service responded with metadata for a different table, treated as an invalid service response.

Source

Thrown at presto-thrift-connector/src/main/java/com/facebook/presto/connector/thrift/ThriftMetadata.java:207

        if (!table.isPresent()) {
            throw new TableNotFoundException(schemaTableName);
        }
        else {
            return table.get();
        }
    }

    // this method makes actual thrift request and should be called only by cache load method
    private Optional<ThriftTableMetadata> getTableMetadataInternal(SchemaTableName schemaTableName)
    {
        requireNonNull(schemaTableName, "schemaTableName is null");
        PrestoThriftNullableTableMetadata thriftTableMetadata = getTableMetadata(schemaTableName);
        if (thriftTableMetadata.getTableMetadata() == null) {
            return Optional.empty();
        }
        ThriftTableMetadata tableMetadata = new ThriftTableMetadata(thriftTableMetadata.getTableMetadata(), typeManager);
        if (!Objects.equals(schemaTableName, tableMetadata.getSchemaTableName())) {
            throw new PrestoException(THRIFT_SERVICE_INVALID_RESPONSE, "Requested and actual table names are different");
        }
        return Optional.of(tableMetadata);
    }

    private PrestoThriftNullableTableMetadata getTableMetadata(SchemaTableName schemaTableName)
    {
        // treat invalid names as not found
        PrestoThriftSchemaTableName name;
        try {
            name = new PrestoThriftSchemaTableName(schemaTableName);
        }
        catch (IllegalArgumentException e) {
            return new PrestoThriftNullableTableMetadata(null);
        }

        try {
            return client.get().getTableMetadata(name);
        }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Fix the Thrift service to echo back the exact requested schema/table name
  2. Match identifier casing between client request and service response
  3. Upgrade/restart the external Thrift connector service if it has a known bug
  4. Verify the service implementation handles unknown tables by returning null rather than partial metadata

Example fix

// before (thrift service)
return new PrestoThriftTableMetadata("", tableName, columns);
// after
return new PrestoThriftTableMetadata(requestedSchema, requestedTable, columns);
Defensive patterns

Strategy: try-catch

Validate before calling

// verify the thrift service echoes names: assert response.getTableMetadata().getSchemaName().equals(requestedSchema) && response.getTableMetadata().getTableName().equals(requestedTable)

Try / catch

try { return thriftMetadata.getTableHandle(name); } catch (PrestoException e) { if (THRIFT_SERVICE_INVALID_RESPONSE == e.getErrorCode().getCode()) { refreshServiceClient(); return retryLookup(name); } throw e; }

Prevention

When it happens

Trigger: Thrift connector server returns PrestoThriftTableMetadata whose schemaTableName differs from the requested SchemaTableName (lookup is typically case-sensitive).

Common situations: Misbehaving or buggy Thrift service returning default/empty names, case normalization differences between the service and Presto, or stale caching in the external service.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/c3a86e17628984fe. Report an issue: GitHub.