{"record":{"id":"0ad437c63247a409","repo":"prestodb/presto","slug":"bigquery-query-failed-unknown","errorCode":"BIGQUERY_QUERY_FAILED_UNKNOWN","errorMessage":"Failed to run the query [%s]","messagePattern":"Failed to run the query \\[(.+?)\\]","errorType":"error_code","errorClass":"BigQueryException","httpStatus":null,"severity":"error","filePath":"presto-bigquery/src/main/java/com/facebook/presto/plugin/bigquery/BigQueryClient.java","lineNumber":155,"sourceCode":"\n    protected Table update(TableInfo table)\n    {\n        return bigQuery.update(table);\n    }\n\n    protected Job create(JobInfo jobInfo)\n    {\n        return bigQuery.create(jobInfo);\n    }\n\n    protected TableResult query(String sql)\n    {\n        try {\n            return bigQuery.query(QueryJobConfiguration.of(sql));\n        }\n        catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            throw new BigQueryException(BIGQUERY_QUERY_FAILED_UNKNOWN.toErrorCode().getCode(), format(\"Failed to run the query [%s]\", sql), e);\n        }\n    }\n\n    protected String createSql(TableId table, List<String> requiredColumns)\n    {\n        String columns = requiredColumns.isEmpty() ? \"*\" :\n                requiredColumns.stream().map(column -> format(\"`%s`\", column)).collect(joining(\",\"));\n\n        return createFormatSql(table, columns, new String[] {});\n    }\n\n    protected String createFormatSql(TableId table, String requiredColumns, String[] filters)\n    {\n        String tableName = fullTableName(table);\n\n        String whereClause = createWhereClause(filters)\n                .map(clause -> \"WHERE \" + clause)\n                .orElse(\"\");","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-bigquery/src/main/java/com/facebook/presto/plugin/bigquery/BigQueryClient.java#L137-L173","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-run the query; this error reflects interruption, not necessarily query failure","Check server logs for what cancelled/interrupted the query (user cancel, timeout setting)","Increase the query timeout if the query is legitimately long-running and being timed out","Inspect the BigQuery job history to see if the job completed despite the interruption"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// No pre-call validation possible for interruption; optionally check thread state:\nif (Thread.currentThread().isInterrupted()) {\n    throw new IllegalStateException(\"Thread already interrupted; do not start BigQuery query\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    var result = table.query(sql);\n} catch (BigQueryException e) {\n    if (\"BIGQUERY_QUERY_FAILED_UNKNOWN\".equals(e.getErrorCode().getName()) && e.getCause() instanceof InterruptedException) {\n        // restore interrupt flag and/or retry with backoff if query should continue\n        // Thread.currentThread().interrupt();\n    } else {\n        throw e;\n    }\n}","preventionTips":["Increase query timeouts so long BigQuery queries aren't cancelled mid-flight","Avoid cancelling the Presto task if the query result is needed; instead tune the query","Use BigQuery job IDs / job history to check whether an interrupted job actually completed","Handle interruption semantics: respect the interrupt flag rather than immediately retrying"],"tags":["bigquery","interrupted","query","google-cloud"],"backgroundTag":"query-interrupted","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}