prestodb/presto · error · BigQueryException

BIGQUERY_QUERY_FAILED_UNKNOWN

BIGQUERY_QUERY_FAILED_UNKNOWN

Error message

Failed to run the query [%s]

What it means

BigQueryClient.query submits a SQL query to BigQuery via the client library's bigQuery.query call. If the call is interrupted while waiting for results, the code restores the interrupt flag and throws BigQueryException with code BIGQUERY_QUERY_FAILED_UNKNOWN. The query may have actually been accepted by BigQuery; only the wait was interrupted.

Source

Thrown at presto-bigquery/src/main/java/com/facebook/presto/plugin/bigquery/BigQueryClient.java:155

    protected Table update(TableInfo table)
    {
        return bigQuery.update(table);
    }

    protected Job create(JobInfo jobInfo)
    {
        return bigQuery.create(jobInfo);
    }

    protected TableResult query(String sql)
    {
        try {
            return bigQuery.query(QueryJobConfiguration.of(sql));
        }
        catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new BigQueryException(BIGQUERY_QUERY_FAILED_UNKNOWN.toErrorCode().getCode(), format("Failed to run the query [%s]", sql), e);
        }
    }

    protected String createSql(TableId table, List<String> requiredColumns)
    {
        String columns = requiredColumns.isEmpty() ? "*" :
                requiredColumns.stream().map(column -> format("`%s`", column)).collect(joining(","));

        return createFormatSql(table, columns, new String[] {});
    }

    protected String createFormatSql(TableId table, String requiredColumns, String[] filters)
    {
        String tableName = fullTableName(table);

        String whereClause = createWhereClause(filters)
                .map(clause -> "WHERE " + clause)
                .orElse("");

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Re-run the query; this error reflects interruption, not necessarily query failure
  2. Check server logs for what cancelled/interrupted the query (user cancel, timeout setting)
  3. Increase the query timeout if the query is legitimately long-running and being timed out
  4. Inspect the BigQuery job history to see if the job completed despite the interruption
Defensive patterns

Strategy: retry

Validate before calling

// No pre-call validation possible for interruption; optionally check thread state:
if (Thread.currentThread().isInterrupted()) {
    throw new IllegalStateException("Thread already interrupted; do not start BigQuery query");
}

Try / catch

try {
    var result = table.query(sql);
} catch (BigQueryException e) {
    if ("BIGQUERY_QUERY_FAILED_UNKNOWN".equals(e.getErrorCode().getName()) && e.getCause() instanceof InterruptedException) {
        // restore interrupt flag and/or retry with backoff if query should continue
        // Thread.currentThread().interrupt();
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Executing a BigQuery SQL query when the calling thread is interrupted (query cancellation, shutdown, or Presto's own cancellation mechanism) while blocked on the Google client's API call.

Common situations: Users cancelling long-running queries in Presto; query timeout causing task interruption; coordinator shutdown during a BigQuery query; slow BigQuery job exceeding client wait expectations.

Related errors


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