Skip to content

Fix/error code hints 215#243

Open
XXOriginalXX wants to merge 5 commits into
mlcommons:devfrom
XXOriginalXX:fix/error-code-hints-215
Open

Fix/error code hints 215#243
XXOriginalXX wants to merge 5 commits into
mlcommons:devfrom
XXOriginalXX:fix/error-code-hints-215

Conversation

@XXOriginalXX
Copy link
Copy Markdown

Summary

Fixes #215

When a script exits with a non-zero return code, MLCFlow now displays a
human-readable hint alongside the exit code to help users diagnose failures
faster — without needing to look up exit codes manually.

Changes

  • Added _SCRIPT_EXIT_CODE_HINTS dict mapping common exit codes to advice
  • Added _get_exit_code_hint() helper function (handles POSIX codes + curl network codes 6/7)
  • Updated ScriptExecutionError to accept and store return_code, appending the hint to the exception message
  • Updated call_script_module_function to pass result["return"] as return_code when raising
  • Updated README with new Error Code Hints section and table
  • Added GitHub Actions CI test

Testing

Tested locally on Windows. CI workflow included.
All existing tests pass.

@XXOriginalXX XXOriginalXX requested a review from a team as a code owner May 24, 2026 13:55
@github-actions
Copy link
Copy Markdown

MLCommons CLA bot:
Thank you very much for your submission; we really appreciate it. Before we can accept your contribution,
we ask that you sign the MLCommons CLA (Apache 2). Please submit your GitHub ID to our onboarding form to initiate
authorization. If you are from a MLCommons member organization, we will request that you be added to the CLA.
If you are not from a member organization, we will email you a CLA to sign. For any questions, please contact
[email protected].
0 out of 1 committers have signed the MLCommons CLA.
@XXOriginalXX
You can retrigger this bot by commenting recheck in this Pull Request

Comment thread mlc/script_action.py
}


def _get_exit_code_hint(return_code: int) -> str:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you for the contribution!
Can you please remove any formatting for the existing code? - there's an autoformatter running in github action which will otherwise reformat the code again.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done applied autopep8 formatting to script_action.py.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants