Question stuck in "Loading"

I have custom SQL question that is now stuck in "Loading", with no way to access the question itself to retrieve the SQL code or to edit it.

The last thing I did with it was to add a field filter inside of a CTE. When I tried to select a field for the filter to map to, the dropdown wouldn't open, then I saved the question and closed it to start over.

Is there any way to at least retrieve the code of the question to create a new one?

{
"browser-info": {
"language": "en-GB",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 Edg/98.0.1108.62",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.14.1+1",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.14.1",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.14.1+1",
"os.name": "Linux",
"os.version": "4.14.219-164.354.amzn2.x86_64",
"user.language": "en",
"user.timezone": "GMT"
},
"metabase-info": {
"databases": [
"postgres",
"googleanalytics",
"bigquery-cloud-sdk",
"bigquery"
],
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "11.9"
},
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.2.23"
}
},
"run-mode": "prod",
"version": {
"date": "2022-02-28",
"tag": "v1.42.2",
"branch": "release-x.42.x",
"hash": "d6ff494"
},
"settings": {
"report-timezone": "Europe/Berlin"
}
}
}

Hi @fr1tkot
What exactly do you mean by "loading" - can you provide a screenshot?
The metadata for questions are available via /api/card/123, where 123 is the question ID.
But I'm wondering what could have happened to cause this, so it would be great to see the metadata - perhaps I can spot the problem, so we can make sure this doesn't happen again.

@flamber thanks for taking a look. I was able to retrieve the SQL via the /api/card endpoint, so I will just create a new one. The screen is just this one, it's the first thing I get after accessing the question:

Let me know if you'd like any more info.

@fr1tkot Hmmm.... interesting.
Are you seeing any errors in Admin > Troubleshooting > Logs, or in the browser developer console?

Here's everything related to that question I can find in the logs. As far as I can see, there is no query being run on the warehouse (BigQuery).

[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:08:56+01:00 DEBUG metabase.server.middleware.log POST /api/dashboard/94/dashcard/659/card/891/query 202 [ASYNC: completed] 13.5 s (17 DB calls) App DB connections: 0/15 Jetty threads: 2/50 (30 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued); postgres DB 35 connections: 9/15 (0 threads blocked)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:08:56+01:00 DEBUG metabase.server.middleware.log GET /api/collection/115 200 4.5 ms (3 DB calls) App DB connections: 0/15 Jetty threads: 3/50 (29 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:08:56+01:00 DEBUG metabase.server.middleware.log GET /api/collection/115/items 200 17.5 ms (5 DB calls) App DB connections: 0/15 Jetty threads: 4/50 (28 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:08:56+01:00 DEBUG metabase.server.middleware.log GET /api/collection/115/items 200 22.0 ms (6 DB calls) App DB connections: 0/15 Jetty threads: 3/50 (29 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:08:57+01:00 DEBUG metabase.server.middleware.log GET /api/collection/231 200 13.4 ms (4 DB calls) App DB connections: 0/15 Jetty threads: 3/50 (29 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:08:57+01:00 DEBUG metabase.server.middleware.log GET /api/collection/231/items 200 19.4 ms (6 DB calls) App DB connections: 1/15 Jetty threads: 4/50 (28 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:08:57+01:00 DEBUG metabase.server.middleware.log GET /api/collection/231/items 200 22.6 ms (6 DB calls) App DB connections: 0/15 Jetty threads: 3/50 (29 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:09:08+01:00 DEBUG metabase.server.middleware.log GET /api/user/current 200 5.8 ms (4 DB calls) App DB connections: 1/15 Jetty threads: 4/50 (28 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:09:08+01:00 DEBUG metabase.server.middleware.log GET /api/session/properties 200 16.9 ms (4 DB calls) App DB connections: 0/15 Jetty threads: 3/50 (29 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:09:09+01:00 DEBUG metabase.server.middleware.log GET /api/card/1682 200 26.3 ms (10 DB calls) App DB connections: 1/15 Jetty threads: 4/50 (28 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:09:09+01:00 DEBUG metabase.server.middleware.log GET /api/database 200 9.3 ms (3 DB calls) App DB connections: 1/15 Jetty threads: 4/50 (28 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:09:09+01:00 DEBUG metabase.server.middleware.log GET /api/alert/question/1682 200 2.6 ms (1 DB calls) App DB connections: 0/15 Jetty threads: 3/50 (29 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:09:11+01:00 DEBUG metabase.server.middleware.log GET /api/session/properties 200 39.4 ms (4 DB calls) App DB connections: 1/15 Jetty threads: 4/50 (28 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:09:11+01:00 DEBUG metabase.server.middleware.log GET /api/setting 200 44.9 ms (3 DB calls) App DB connections: 0/15 Jetty threads: 4/50 (28 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:09:11+01:00 DEBUG metabase.server.middleware.log GET /api/setup/admin_checklist 200 23.3 ms (11 DB calls) App DB connections: 0/15 Jetty threads: 3/50 (29 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)
[f9424d34-6336-4b63-bb05-7f94fc6d84f0] 2022-03-05T10:09:14+01:00 DEBUG metabase.server.middleware.log GET /api/dashboard/164 200 99.2 ms (35 DB calls) App DB connections: 1/15 Jetty threads: 3/50 (29 idle, 0 queued) (167 total active threads) Queries in flight: 0 (0 queued)

@fr1tkot I'm guessing that it's question 1682?
There should be errors in the browser developer console.
And seeing the question metadata could help understand why it's failing. I guess there's some incomplete reference somewhere.

Also, you are both using the old and the new BigQuery driver, so does this relate to the old or new?

Question 1682 is correct, it's on the new BQ driver.

Just looked at the browser console myself and it does bring up an error I don't see on other questions:

This is the metadata, I've removed the query as there doesn't seem to be anything wrong with it, I copy-pasted it into a new question and it worked straight away.

{
"description": null,
"archived": false,
"collection_position": null,
"table_id": null,
"result_metadata": null,
"creator": {
"email": "f",
"first_name": "",
"last_login": "2022-03-04T08:54:28.162903Z",
"is_qbnewb": false,
"is_superuser": true,
"id": 152,
"last_name": "",
"date_joined": "2021-12-30T16:48:12.330592Z",
"common_name": ""
},
"can_write": true,
"database_id": 101,
"enable_embedding": false,
"collection_id": 231,
"query_type": "native",
"name": "Order Volume Forecast",
"last_query_start": "2022-03-04T07:47:35.577872Z",
"dashboard_count": 0,
"average_query_time": 3581.8571428571428571,
"creator_id": 152,
"moderation_reviews": [

],
"updated_at": "2022-03-04T07:49:07.608079Z",
"made_public_by_id": null,
"embedding_params": null,
"cache_ttl": null,
"dataset_query": {
"database": 101,
"native": {
"template-tags": {
"#1441": {
"id": "c125561e-ff08-2bb3-7f28-2b2668abc672",
"name": "#1441",
"display-name": "#1441",
"type": "card",
"card-id": 1441
},
"Owner": {
"id": "4a48c234-ab72-ae7d-77ec-a3c099bee9b2",
"name": "Owner",
"display-name": "Owner",
"type": "dimension",
"required": false,
"widget-type": "category"
}
},
"query": ""
},
"type": "native"
},
"id": 1682,
"display": "line",
"last-edit-info": {
"id": 152,
"email": "",
"first_name": "",
"last_name": "",
"timestamp": "2022-03-04T07:49:07.649861Z"
},
"visualization_settings": {
"graph.show_goal": true,
"graph.show_values": true,
"table.columns": [
{
"name": "report_month",
"fieldRef": [
"field",
"report_month",
{
"base-type": "type/Date"
}
],
"enabled": true
},
{
"name": "scaled_order_volume_monthly",
"fieldRef": [
"field",
"scaled_order_volume_monthly",
{
"base-type": "type/Float"
}
],
"enabled": true
},
{
"name": "order_volume_fraction",
"fieldRef": [
"field",
"order_volume_fraction",
{
"base-type": "type/Float"
}
],
"enabled": true
},
{
"name": "one_months_ago",
"fieldRef": [
"field",
"one_months_ago",
{
"base-type": "type/Float"
}
],
"enabled": true
},
{
"name": "two_months_ago",
"fieldRef": [
"field",
"two_months_ago",
{
"base-type": "type/Float"
}
],
"enabled": true
},
{
"name": "three_months_ago",
"fieldRef": [
"field",
"three_months_ago",
{
"base-type": "type/Float"
}
],
"enabled": true
},
{
"name": "four_months_ago",
"fieldRef": [
"field",
"four_months_ago",
{
"base-type": "type/Float"
}
],
"enabled": true
},
{
"name": "five_months_ago",
"fieldRef": [
"field",
"five_months_ago",
{
"base-type": "type/Float"
}
],
"enabled": true
},
{
"name": "forecasted_order_volume",
"fieldRef": [
"field",
"forecasted_order_volume",
{
"base-type": "type/Float"
}
],
"enabled": true
},
{
"name": "fully_vested_deals",
"fieldRef": [
"field",
"fully_vested_deals",
{
"base-type": "type/Float"
}
],
"enabled": true
},
{
"name": "order_volume_monthly",
"fieldRef": [
"field",
"order_volume_monthly",
{
"base-type": "type/Float"
}
],
"enabled": true
}
],
"table.cell_column": "scaled_order_volume_monthly",
"graph.goal_label": "Global H1 Goal Line",
"graph.goal_value": 140000,
"graph.y_axis.auto_split": false,
"graph.metrics": [
"forecasted_order_volume"
],
"table.pivot_column": "five_months_ago",
"column_settings": {
"["name","forecasted_order_volume"]": {
"number_separators": ",."
},
"["name","order_volume_monthly"]": {
"number_separators": ",."
},
"["name","previous_6_months_volume"]": {
"number_separators": ",."
},
"["name","scaled_order_volume_monthly"]": {
"number_separators": ",."
},
"["name","one_months_ago"]": {
"number_separators": ",."
},
"["name","scaled_order_volume_forecast"]": {
"number_separators": ",."
},
"["name","report_month"]": {
"date_abbreviate": true
},
"["name","scaled_deal_amount_forecast"]": {
"number_style": "currency",
"number_separators": ",."
},
"["name","previous_6_months_scaled_vol"]": {
"number_separators": ",."
},
"["name","five_months_ago"]": {
"number_separators": ",."
},
"["name","three_months_ago"]": {
"number_separators": ",."
},
"["name","two_months_ago"]": {
"number_separators": ",."
},
"["name","deal_amount_monthly"]": {
"number_style": "currency",
"number_separators": ",."
},
"["name","order_volume_fraction"]": {
"number_separators": ",."
},
"["name","four_months_ago"]": {
"number_separators": ",."
}
},
"graph.y_axis.auto_range": true,
"graph.x_axis.scale": "timeseries",
"graph.dimensions": [
"report_month"
],
"stackable.stack_type": null
},
"collection": {
"authority_level": null,
"description": null,
"archived": false,
"slug": "finalized_dashboards_queries_florian",
"color": "#509EE3",
"name": "Finalized Dashboards/Queries Florian",
"personal_owner_id": null,
"id": 231,
"location": "/115/",
"namespace": null
},
"dataset": false,
"created_at": "2022-02-25T08:58:03.876972Z",
"public_uuid": null
}

@fr1tkot Okay, so the problem comes from the Owner variable is set to a Field Filter, but there's actually no field reference. I'm not entire sure how you ended up with that. Wondering if it perhaps happened already on a previous version given that widget-type: category doesn't exists on v42 anymore.

I cannot reproduce even on older versions.

Yes, what happened was that I had just defined the field filter variable but couldn't open the dropdown to select a field to connect it to. Could've been a browser or connectivity issue. After I closed out of the tab, I couldn't access the question anymore. Could be connected to the version upgrade as well.

Pretty sure this is a one-off type of scenario and I was able to retrieve the SQL in the end, so it's all good. It would be better though if the system prevented invalid question states from being stored.

@fr1tkot I agree. I've created an issue for it:
https://github.com/metabase/metabase/issues/20865 - upvote by clicking :+1: on the first post