fix: improve Python step error messages for better debugging#6184
Closed
DragonBot00 wants to merge 1 commit intokeephq:mainfrom
Closed
fix: improve Python step error messages for better debugging#6184DragonBot00 wants to merge 1 commit intokeephq:mainfrom
DragonBot00 wants to merge 1 commit intokeephq:mainfrom
Conversation
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
|
@DragonBot00 is attempting to deploy a commit to the KeepHQ Team on Vercel. A member of the Team first needs to authorize it. |
|
Closing — no maintainer engagement after 5 days. Shifting focus to quality over quantity. |
1 similar comment
Contributor
Author
|
Closing — no maintainer engagement after 5 days. Shifting focus to quality over quantity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5327
Problem
When a workflow uses a Python step provider and the code contains a syntax error, the error message was extremely unclear. Instead of surfacing the actual Python SyntaxError, Keep would dump the entire rendered provider config string (including unrelated details like Kibana endpoints, ports, and validation tokens) as the error message.
Example of the confusing error (before this fix):
\
Got SyntaxError while parsing token 'keep.kb.us-central1.gcp.cloud.es.io', 'validation': 'any_http_url'...
\\
This message has nothing to do with the user's Python code and is actively misleading.
Root Cause
In \python_provider.py, the _query\ method calls \self.io_handler.parse(code)\ to render Jinja templates inside the code string. When this rendering fails with a \SyntaxError\ (or when the rendered code fails inside \eval()), the exception message includes the raw rendered token — which can contain provider configuration data (URLs, authentication tokens, ports, etc.) from the workflow context.
Fix
Example of the improved error (after this fix):
\
SyntaxError in Python step 'my-python-step': invalid syntax (line 3)
\\
Testing
Manual verification that: