Query Triggering For No Apparent Reason

Hi there, a "Create" query on my app is triggering when i update the form for no apparent reason.

As you can see in these screenshots I have no event handlers set up on the text input or the form, but I am still seeing this CreateRecommendation query getting triggered every time I update. The stack trace in the debugger indicates that this request is being triggered by "user interaction" in the text field.

Could I please have some help understanding what is causing this?

Hey @ecookie! Happy to help with this. Is this the event handler that's triggering the CreateRecommendation query, by any chance?

Hi, thank you for looking!

Yes, that script does call CreateCommendation (conditionally), but I do not believe that is what is causing this. I tried adding a console.log("SUBMIT FORM") line at the top of this script and do not see that log at all while typing into the text field.

Looking again, I think the error isn't being triggered by an unexpected query submit, but instead by an attempt to update the query's changeset behind the scenes as the form data changes. I am passing through that recommendationId manually from the submit script. Maybe there's a better way to denote update parameters as "manual only"?

For visibility, here's the contents of that submit script - maybe there's a more "retool-y" way to coordinate these relation table writes?

console.log("SUBMIT FORM")

const currRec = RecommendationTable.selectedRow;

let recommendationId;
let needIds = [];

if (!!currRec) {
  recommendationId = currRec.id;
  needIds = currRec.needs.map(n => n.id);

if (!!recommendationId) {
  await UpdateRecommendation.trigger();
} else {
  recommendationId = uuid.v4();
  await CreateRecommendation.trigger({
    additionalScope: {

const selectedNeedIds = RecommendationForm.data.needIds;

const deleteNeedIds = _.difference(needIds, selectedNeedIds);
if (deleteNeedIds.length > 0) {
    additionalScope: {
      needIds: deleteNeedIds

const addNeedIds = _.difference(selectedNeedIds, needIds);
const newJoins = addNeedIds.map(needId => ({
  recommendation_id: recommendationId,
  need_id: needId,
if (addNeedIds.length > 0) {
    additionalScope: { newJoins }

await FetchRecommendations.trigger();

  key: recommendationId 
"Looking again, I think the error isn't being triggered by an unexpected query submit, but instead by an attempt to update the query's changeset behind the scenes as the form data changes"

In this case, setting the query to run only when Manually Triggered would be your best bet! Though it looks like your query is already set to that. Are you watching any inputs by any chance?

In your code, CreateRecommendation is getting triggered when !!recommendationId is false. Is that the only place that your Submit Script is triggering CreateRecommendation? Strange that "SUBMIT FORM" only console logs once, but CreateRecommendation gets triggered so many times :thinking:

We are watching a few inputs, but nothing that would trigger the query.

I was able to very easily reproduce this bug(?) in a test app with a single text input and a single query that uses both the value of that text input and a parameter meant to be provided manually. Every time I change the test in the input, a similar error triggers.

The issue almost certainly seems to lie in the internals of the query managing its changeset, but not knowing what to do with the manual parameter. If you guys just added a better way to handle those manual parameters in GUI mode (either outside of the changeset or with a flag of some sort?) I think this wouldn't be an issue anymore. You'd get the added benefit of those parameters not showing up as errors in the query editor.

even just some special internal function like useManualParameter("email") that we could use in the query definition instead of the bare {{ email }} reference might work with barely any effort?

I was finally able to reproduce this! Thank you so much for the clear repro instructions. I created a regression report for this (since it looks like this worked on older versions) and will let you know.

In the meantime, the best workaround would probably be to disable the query on some condition (if some additionalScope variable is defined, for example) to make sure it only runs when you want it to.

I'm sorry this has been plaguing you for so long, and I hope to have good news here soon.

I've got a similar issue, a query is triggered every time some text inputs change. These inputs do not have an event handler on change (only on blur) and the query being triggered is not watching these inputs. I get the same error mentioning the changeset:

Error: notes is not defined
    from UpdateLead.changeset update(UpdateLead)
    from form1.data update(form1)
    from textArea11.value update(textArea11)
    from user interaction

Query settings are a match as well:

  • "Run query only when manually triggered" is selected
  • I am using the "SQL mode" additional scope workaround to trigger this query with specific data (add additional scope variable in SQL mode then switch to GUI mode)
  • No watched inputs
  • Only two variables are referenced in the query: an additional scope variable passed in when I trigger the query and a custom variable that does not relate to any of the inputs.

This only happens with the text inputs, a number input in this form does not cause the error.

Strangely, the variable mentioned as not defined in the error has nothing to do with the query directly. I think it was at one point in the past but is no longer directly referenced in the query.

I checked in on the bug that Victoria submitted, and it's still in our queue :disappointed:
@benp, if you can share a screenshot or recording of the query that would be helpful to pass along to the team that owns this

I'll post here if we get any updates on a fix