When a statement is refused, the error lists each problem in meta.violations, often with the names you can use instead.
The function cannot be used here
The function "<f>" cannot be used here. Rewrite the expression using one of the supported functions, listed under `functions` on GET /api/v1/query/schema...LangWatchQL accepts a fixed list of ClickHouse functions. Rewrite the expression with one from the allowedFunctions list in the error, or from langwatch query schema. The supported functions are also listed in the reference.
The view is not available to you
The view "<v>" is not available to you. Use one of the views from the schema endpoint.Check the spelling. Pick a view from the availableViews list in the violation, or from langwatch query schema. There is no conversations or threads view: group trace_metrics by ConversationId instead.
If you prefixed a real view with another deployment's database, for example analytics.traces, the message says so instead:
"<db>" is not this deployment's database. Write the bare view name "<v>": a bare name resolves to the database each deployment serves, so the same statement runs everywhere.The eval function is not available to you
The function "<f>" is not available to you. A judgement is charged to one project, so it runs only in a query from one project, and only where Instant Evals is switched on for the organization. Run the query from one project, switch Instant Evals on for the organization, or remove the call.First make the run read one project: use a project key, or name the project with projects in the request or --project on the CLI. In the app, a query cannot call eval functions when it names any project other than the one it runs from, which projects: "all" does once you can read another live project in its organization, or when it runs from a project that reads other projects.
If the run already reads one project, Instant Evals is not switched on for the organization, or no judge is configured. A self-serve organization switches Instant Evals on from the search bar; a member without organization management rights is asked to turn to an organization admin. See Limits and cost. If you self-host, see what to do in Instant Evals through Connect.
The field is not available to you
The field "<c>" is not available to you. Remove it from the query.The column is gated. Message text (input and output columns such as CapturedInput) follows the project's data privacy policy: if Input or Output content is Restricted to an audience you are not in, or Dropped, you cannot read it. Cost columns need the cost:view permission on your key. Remove the column, ask an admin to change Settings > Data Privacy or your access, or use a key with the permission. The error lists the columns you can read in availableColumns.
A wildcard cannot be used here
List the fields you need by nameThe message goes on to say that a wildcard cannot be used, because some fields are not available to you.
Replace SELECT * with the column names. langwatch query schema lists them.
The LIMIT is above the maximum
The LIMIT of N rows is above the maximum of 10,000 rows this API returns per request. Lower it and page the rest with LIMIT/OFFSET and an ORDER BY.Set LIMIT 10000 or lower and page through the rest, as in How do I get more than 10,000 rows.
Only a single SELECT statement can be submitted
Only a single SELECT statement, optionally with a WITH clause, can be submitted here.Only one statement can be submitted at a time. Send a single SELECT statement.LangWatchQL is read-only. Send one SELECT, with no INSERT, ALTER or second statement after a ;. FORMAT, INTO OUTFILE, table functions and system databases are refused too.
This is not valid ClickHouse SQL
This is not valid ClickHouse SQL. Check the syntax and try again.Check quotes, commas and brackets. Parameters are written {name:Type}, for example {days:UInt32}.
A SETTINGS clause cannot be used here
A SETTINGS clause cannot be used here.The message goes on to say that execution settings are fixed by the API.
Remove the SETTINGS clause. Run time, memory and the other server limits are the same for every query, see Limits and cost.
The query names a column that does not exist
The query names a column that does not exist: X.Check the column against langwatch query schema. Columns differ between views: for example, HasError is on trace_metrics, while traces has ContainsErrorStatus.
The query declares parameters the request did not supply
The query declares bound parameters the request did not supply values for.meta.parameters lists the missing names. Send a value for each under parameters, keyed by the name inside the braces: {since:DateTime} reads parameters.since.
The query timed out or read too much data
Query timed out (X.Xs)Query would read more data than its scan limit allows and was abortedIf the query reads captured input or output, leave those columns out until the other filters have narrowed the rows. Narrow the time filter, filter on the view's time column if the query does not yet, or move a count or sum over time to trace_metrics_by_minute or model_usage_by_minute, which hold data already summed per minute.
Too many queries
Too many LangWatchQL queries for this project.Too many LangWatchQL queries are running right now.The first is the per-minute rate limit (429): wait the number of seconds in meta.retryAfterSeconds. The second means too many queries are running at once (503): retry after the running ones finish. Plan limits are in Limits and cost.