Skip to content

fix(ai-prompt-template): fix malformed JSON error message#13096

Open
sihyeonn wants to merge 1 commit intoapache:masterfrom
sihyeonn:fix/ai-prompt-template-error-msg
Open

fix(ai-prompt-template): fix malformed JSON error message#13096
sihyeonn wants to merge 1 commit intoapache:masterfrom
sihyeonn:fix/ai-prompt-template-error-msg

Conversation

@sihyeonn
Copy link
Contributor

Description

The error message in get_request_body_table() had two issues:

  1. Grammatical error: "could not get parse" instead of "could not parse"
  2. String concatenation bug: err was added as a separate table element ({ message = "...: ", err }) instead of being concatenated to the message string ({ message = "...: " .. err }), causing the error detail to be silently dropped from the response.

The correct pattern already exists in ai-prompt-decorator.lua:76.

Before

return nil, { message = "could not get parse JSON request body: ", err }

After

return nil, { message = "could not parse JSON request body: " .. err }

The error message in get_request_body_table() had two issues:
- Grammatical error: "could not get parse" instead of "could not parse"
- The err variable was added as a separate table element instead of
  being concatenated to the message string, causing the error detail
  to be silently dropped.

This aligns with the correct pattern used in ai-prompt-decorator.lua.

Signed-off-by: Sihyeon Jang <sihyeon.jang@navercorp.com>
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Mar 18, 2026
@Baoyuantop
Copy link
Contributor

Please update the code in all relevant places.

@Baoyuantop
Copy link
Contributor

Hi @sihyeonn, following up on the previous review comments. Please let us know if you have any updates. Thank you.

@sihyeonn
Copy link
Contributor Author

Hi, thanks for the follow-up. The fix has been applied — the error message now correctly reflects the malformed JSON case. Ready for review whenever you get a chance.

@Baoyuantop
Copy link
Contributor

Hi @sihyeonn, I mean, there are several similar errors; could you fix them all at once?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants