Skip to content
Last updated

When a Query Answer Looks Wrong

WebDesktopMobile

A number that looks wrong has several possible authors: the request you made, the skills that shaped the SQL, the statement itself, the query engine, or the model's reading of what came back. This page is the triage — it maps a symptom to the layer that produced it, so you spend your time where the fix is. For why answers vary in the first place, and how to stop them varying across a team, see Getting Reliable Answers.

Check these two first

Is the SQL what you meant? Expand the tool call and read the statement — that is the question your data actually answered. Are the SQL skills on? They are not enabled by default, and without them the agent writes generic SQL. See Turn On the SQL Skills.

Prerequisites


What to Check When an Answer Looks Wrong

Symptom Most likely cause What to do
The SQL avoids TD functions, scans whole tables, or uses the wrong engineSkillsEnable sql-skills in Settings → Marketplace — it is not on by default. See Turn On the SQL Skills
The number is plausible but wrong by an order of magnitudeThe SQLRead the statement: often a missing time bound, a join that multiplies rows, or the wrong table
Test or cancelled records are countedYour requestThose filters exist only if someone stated them. Say the exclusion and re-run — then write it down where it applies every time (Where Your Business Knowledge Belongs)
Two runs of the same question disagreeRequest + contextFix the table, period, and filters in the prompt, and move the standing ones into instructions or a skill — see Getting Reliable Answers
The query fails on memory, or takes minutesThe engineNarrow the time range first, then ask for the trino-optimizer skill. If it still will not run on Trino, it has to be rewritten for Hive and submitted as a job — see Trino Runs in the Chat; Hive Runs as a Job
The figures are right but the conclusion is inventedInterpretationTreat the analysis as a draft. Ask what the claim is based on, and check it against the tool output
Quality dropped after a new skill was installedCustom skillsA skill's instructions apply to every matching request. Turn the suspect plugin off, ask again, and compare
The chat gets vaguer the longer it runsContext, not SQLA large result or a long session leaves less room for what comes next. Start a new chat — see In-Session Memory

Reading the Query Itself

Most wrong numbers are visible in the statement, and three things account for most of them:

  • The table it chose. The agent picks from what it discovered; a similarly named table is easy to miss in prose and obvious in the FROM clause.
  • The time bound. A missing or wrong interval is a common reason a figure comes back off by an order of magnitude.
  • The filters you assumed. Test accounts, cancelled orders, and soft-deleted rows are excluded only if someone said so.

Correct the specific thing rather than asking again from scratch — "exclude rows where status = 'test' and re-run" keeps the rest of the query intact.

Connected warehouses

Snowflake and Databricks are queried through their connector rather than tdx, so the skills and engine rows above do not apply — the dialect, the permissions, and the error messages are the warehouse's own. The rest of this triage still holds: read the statement in the tool call, and treat the summary as an interpretation. See Querying a Connected Warehouse.

Pinning It Down

If the triage above has not settled it, work through this checklist. Each step rules out one layer, and most problems are solved before the list ends — an answer that cannot be reproduced was usually a one-off, and one that reproduces tells you exactly where it lives.

  • Ask the same question again in a new chat. If it does not reproduce, the earlier conversation's context was the cause, not the query
  • Run the SQL from the tool call yourself, in the console or Treasure Code. Same number? Then the query is sound and the problem is upstream in your request or downstream in the summary
  • Toggle the suspect plugin off and repeat the request. Change one plugin at a time
  • Read the work folder's instructions and your organization's custom instruction. A standing rule you forgot about explains a surprising number of "wrong" answers
  • Check the figures in the reply against the raw output one more time — the disagreement may be in the restatement, not the data

What you are left with is a record: the SQL that ran, the request you made verbatim, the plugins that were enabled, the instructions in force, the job id if the query reached the engine, and the result you expected instead. Keep it with the chat. If you do need help — from a colleague who knows the data, or from support — that record is what makes the problem reproducible for them, and saying which layers you already ruled out saves everyone a round.

Next Steps