Hi! Encountering an issue when attempting to generate sql. Anthropic is configured and am able to successfully create AI generated reports in the notebook.
Self hosted; GCP / CloudRun
Thank you!
Hi! Encountering an issue when attempting to generate sql. Anthropic is configured and am able to successfully create AI generated reports in the notebook.
Self hosted; GCP / CloudRun
Thank you!
Can you provide the Metabase log when this error occurred, as well as the diagnostic info so we can see what version of Metabase you are running?
Hey thanks for following up! Was able to get it somewhat working with some prompt refinement. But for initial empty state and “Have Metabot fix it” failures, looks like it’s getting caught up on ask_for_sql_clarification tool calls, with no way to respond or rectify.
DEFAULT 2026-04-30T02:48:56.320736Z 2026-04-30 02:48:56,321 INFO agent.core :: :metabot.agent/run-agent-loop (2651.289579ms) {:profile-id :sql, :msg-count 33}
DEFAULT 2026-04-30T02:48:56.335381Z 2026-04-30 02:48:56,336 DEBUG middleware.log :: e[32mPOST /api/metabot/agent-streaming 202 [ASYNC: completed] 2732ms (21 DB calls) App DB connections: 1/10 Jetty threads: 3/50 (4 idle, 0 queued) (81 total active threads) Queries in flight: 1 (0 queued) {:metabase-user-id 1}e[0m
DEFAULT 2026-04-30T02:50:02.338082Z 2026-04-30 02:50:02,338 INFO metabot.api :: Using native Clojure agent {:profile-id sql, :debug? false}
DEFAULT 2026-04-30T02:50:02.386089Z 2026-04-30 02:50:02,387 INFO agent.core :: Starting agent {:profile :sql, :tools 6, :max-iter 10, :msgs 36}
DEFAULT 2026-04-30T02:50:02.398849Z 2026-04-30 02:50:02,399 DEBUG agent.prompts :: Dialect instructions not found: metabot/prompts/dialects/bigquery-cloud-sdk.md
DEFAULT 2026-04-30T02:50:02.415189Z 2026-04-30 02:50:02,416 INFO agent.messages :: Building message history {:input-message-count 36, :step-count 0, :total-parts 36}
DEFAULT 2026-04-30T02:50:02.415389Z 2026-04-30 02:50:02,416 INFO metabot.self :: Calling LLM {:provider anthropic, :model claude-sonnet-4-6, :parts 36, :tools 6, :tool-choice required, :ai-proxy? false}
DEFAULT 2026-04-30T02:50:03.589731Z 2026-04-30 02:50:03,591 INFO self.claude :: :metabot.claude/request (1172.272412ms) {:model "claude-sonnet-4-6", :msg-count 36, :tool-count 6}
DEFAULT 2026-04-30T02:50:06.659320Z 2026-04-30 02:50:06,660 DEBUG self.core :: Executing tool {:tool-name ask_for_sql_clarification, :arguments {:question Your SQL editor is still empty — the "Unexpected end of statement" error is just BigQuery's way of saying there's no SQL to run.
DEFAULT 2026-04-30T02:50:06.659339Z Would you like me to:
DEFAULT 2026-04-30T02:50:06.659343Z 1. **Re-load one of the recent queries** (like the provider visit counts or the latest visits query)?
DEFAULT 2026-04-30T02:50:06.659346Z 2. **Write a new query** — just describe what you need!
DEFAULT 2026-04-30T02:50:06.659350Z 3. **Paste your SQL here** so I can fix it?, :options [Re-load the provider visit counts by NPI query Re-load the latest visits with provider names query Write a new query — I'll describe it]}}
DEFAULT 2026-04-30T02:50:06.659451Z 2026-04-30 02:50:06,660 INFO tools.clarification :: Asking for SQL clarification {:question Your SQL editor is still empty — the "Unexpected end of statement" error is just BigQuery's way of saying there's no SQL to run.
DEFAULT 2026-04-30T02:50:06.659454Z Would you like me to:
DEFAULT 2026-04-30T02:50:06.659456Z 1. **Re-load one of the recent queries** (like the provider visit counts or the latest visits query)?
DEFAULT 2026-04-30T02:50:06.659459Z 2. **Write a new query** — just describe what you need!
DEFAULT 2026-04-30T02:50:06.659463Z 3. **Paste your SQL here** so I can fix it?, :option-count 3}
DEFAULT 2026-04-30T02:50:06.660948Z 2026-04-30 02:50:06,661 DEBUG self.core :: Tool returned {:tool-name ask_for_sql_clarification, :result-type clojure.lang.PersistentArrayMap}
DEFAULT 2026-04-30T02:50:06.661220Z 2026-04-30 02:50:06,662 INFO self.core :: :metabot.agent/run-tool (2.475842ms) {:tool-name "ask_for_sql_clarification", :tool-call-id "toolu_01Uh6W4pxRXJuFr1J7NsrtAw"}
DEFAULT 2026-04-30T02:50:06.662059Z 2026-04-30 02:50:06,662 INFO metabot.self :: :metabot.agent/call-llm (4246.146382ms) {:provider "anthropic", :model "claude-sonnet-4-6", :part-count 36, :tool-count 6}
DEFAULT 2026-04-30T02:50:06.662205Z 2026-04-30 02:50:06,663 DEBUG agent.core :: Iteration {:n 1, :parts-count 4}
DEFAULT 2026-04-30T02:50:06.662326Z 2026-04-30 02:50:06,663 DEBUG agent.core :: Got parts {:count 4, :types [:start :tool-input :usage :tool-output]}
DEFAULT 2026-04-30T02:50:06.662508Z 2026-04-30 02:50:06,663 INFO agent.core :: Agent loop complete {:iterations 1, :reason :final-response}
DEFAULT 2026-04-30T02:50:06.663231Z 2026-04-30 02:50:06,664 DEBUG agent.core :: :metabot.agent/loop-step (4276.765343ms) {:iteration 1}
DEFAULT 2026-04-30T02:50:06.663443Z 2026-04-30 02:50:06,664 INFO agent.core :: :metabot.agent/run-agent-loop (4277.849915ms) {:profile-id :sql, :msg-count 36}