#MySQL query failing with error "java.lang.IllegalStateException: Parameter at position 0 is not set"

1 messages · Page 1 of 1 (latest)

hard flicker
#

A query that I have been using for a while is now failing to execute. I do not think I have changed anything with it.I have self-hosted docker container w/ Community v1.9.16.

Having trouble figuring out what this means or how to debug further. Any ideas?

"actionId":"62aa450a2677176b434f38c2"
"requestedAt":"2023-04-27 15:50:30"
"requestParams":{
"Query":{
"value":"BEGIN; INSERT INTO media (media_type, entry_datetime, discovery_notes, short_list) SELECT c.id, NOW(), "", IF(true = true , IF(false = true, 0, 1) , 0) FROM categories c LEFT JOIN category_types ct ON ct.id = c.category_type_id WHERE (c.category = "book") and (ct.category_type = "media type"); SELECT @media_id := MAX(id) from media; INSERT INTO books (media_id, title, year, author_id, country_id, entry_datetime, fiction, history, reference, collection) VALUES (@media_id, "All Systems REd", 2017, 22000328, 21000001, NOW(), IF(true = true , 1 , 0), IF(false = true , 1 , 0), IF(false = true , 1 , 0), IF(false = true , 1 , 0)); INSERT INTO categories_media (media_id, category_id, entry_datetime) VALUES ((SELECT max(id) FROM media) , 10000015, NOW()); COMMIT;"
}
}

frosty mountainBOT
#

Hey There,

We've registered your query, and our team will get back to you soon.

Regards,
Pranav

frosty mountainBOT
#

Hey there,
Thank you for reaching out to the Appsmith support team. We've registered your
query, and our team is reviewing it.
In the meantime, to help us debug the issue, please consider following steps and
provide us the information:

  • A loom.com recording of this issue.
  • When did this issue start happening? Was it an update?
  • Context on what is this query doing. There seems to be a lot of moving parts
    here and it's hard to follow.

Best regards,
Jimmy H.

hard flicker
#

Hi @ebon valley - The last time I used this query successfully was 12/30/22. I hadn't used it since then until a few weeks ago. When I tried I got this error. I am guessing an update happened in that window that affected this but I'm not sure how to track that down. If you can show me how to get a log of updates I will provide. Happy to do a loom but since there is some private data I'd prefer not to share publicly. Possible to send a link privately?

frosty mountainBOT
#

Yes, you can send an email to [email protected]. Please use the title of this
thread for the subject and include a link in the email so we can link it to this
thread internally.

hard flicker
#

Done, thank you

frosty mountainBOT
#

Hey! We've received your email and are looking into this.

frosty mountainBOT
#

Hi, could you add [email protected] to your workspace to review this more
quickly and closely? Furthermore, if possible, do I have your approval to run
test queries with this access?

hard flicker
#

Done, and yes feel free to run queries. Please use the app called "Book Portal"

#

Thanks!

frosty mountainBOT
#

No problem! We will look into this.

frosty mountainBOT
#

@hard flicker Could you please provide a link to the Book Portal app?
We're having trouble finding it. Please make sure that you've invited
[email protected] as a developer to the app or workspace the app is in.

hard flicker
#

Apologies @frosty mountain - just seeing now. I just sent the link on the support thread. this is a self hosted version.

frosty mountainBOT
#

In this case, could you please try something for me? Could you disable "Use
Prepared Statement," execute the query again, and show me the Logs screen,
please?

hard flicker
#

@frosty mountain - Use Prepared Statement has been disabled. I have a dynamic binding with a JS Object that returns text with SQL keywords.

#

Here is the log screen with Prep. Stat. disabled, which shows the error that is at the top of this thread:

frosty mountainBOT
#

Thank you, could you please share with me the Errors tab?

hard flicker
#

Apologies, yes, here you go.

frosty mountainBOT
#

Gentle reminder.

hard flicker
#

@frosty mountain I have provided the error screenshot above

frosty mountainBOT
#

@hard flicker Yes, but we need to see the errors tab of that info pane
to get more context from the error.

hard flicker
#

@remote violet this screenshot is the errors tab. I realize I am not on the edit query page, but it is the error from the query. Is that what you are looking for?

#

#1101236321185452043 message

frosty mountainBOT
#

@hard flicker Thank you for this! Apologies for the confusion. Our
integration was down for some time last week and we missed that image.

hard flicker
#

No problem @frosty mountain . Also, let me know if you are having trouble accessing the app that I shared with you. You should feel free to manipulate the app as it is a clone of my production app and is tied to a cloned db for debug purposes.

frosty mountainBOT
#

Thanks!

frosty mountainBOT
#

@hard flicker Could you please send your server logs? You can use the
existing email thread related to this ticket. Let us know here when you send
them, and we will check.

hard flicker
#

@remote violet - done

frosty mountainBOT
#

@hard flicker Are you available for a call regarding this issue?

hard flicker
#

I am

frosty mountainBOT
#

Please stand by. I'll create the meeting.

hard flicker
#

OK, I am actually getting pulled into a work meeting

#

15 minutes ok?

frosty mountainBOT
#

Yes, that's fine. Let me know when your meeting is over. I'll ping you here in
15 min.

hard flicker
#

ok thank you, ready now

frosty mountainBOT
frosty mountainBOT
#

@hard flicker Thank you for your assistance! We will continue to
investigate this matter.

hard flicker
#

Thanks @remote violet - FYI, I removed all of the other apps from that workspace, so the only one in there is where you can reproduce the issue.

frosty mountainBOT
#

Thank you! I'll pass this along to the team.

frosty mountainBOT
#

Hello, it appears that the error was caused by a colon in one of your SELECT
queries inside "add book." The part of the query you had was:

SELECT @media_id := MAX(id) FROM media;

and I changed it to:

SELECT MAX(id) AS media_id FROM media;

Both queries function the same, and now your "add book" query works flawlessly.

Additionally, I opened a bug report for this, and you can track it at this link:
https://github.com/appsmithorg/appsmith/issues/24381

I am awaiting confirmation from your end to validate that the problem has been
resolved.

GitHub

Is there an existing issue for this? I have searched the existing issues Description Queries that contain colons : cannot be executed in MySQL because they will always result in the error: java.lan...

hard flicker
#

That did the trick! Thank you for figuring it out. This workaround seems to work for me 👍