Maximum length for the comment body in issues and PR #27190
-
I would like to know where I can find the maximum length of fields in the API. I am mostly interested with the maximum length for the body parameter for the issues.createComment API. These maximum length are not supplied in this documentation and the error message does not advertise it either. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 2 replies
-
Hey there @vdesjardins 👋 Thanks so much for joining our Community, and for submitting your post! So it is interesting that you’re not getting a valuable error message as it relates to character maximums in your API usage. It would be great to have the results of a PR body/Issue comments are still stored in MySQL as a mediumblob with a maximum value length of 262,144. This equals a limit of 65,536 4-byte unicode characters. So again, it would be cool to see the results of a Though the limits for both PR and Comment body content is the same as mentioned above, and will be enforced both in the UI and from API submitted content. Thanks again! |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for the kind welcome @nethgato :slight_smile: In fact I’m using the Github Action github-script (0.9.0). When the body is too large the step fails with this error:
Now you made me realize that maybe the error is with the github-script action. Probably still related to the length of the body though. |
Beta Was this translation helpful? Give feedback.
-
Very welcome @vdesjardins and thank you for clarifying that you’re working with Actions, and not the API. Though the exact same limitations will apply to your workflow as it relates to the maximum character size I mentioned above. I’m not certain about that |
Beta Was this translation helpful? Give feedback.
-
I found the culprit. In fact the argument too long error was caused by an environment variable passed to the github-script. The step was not even executing. I replaced it with a generated file in the previous step and just reading it back in the github-script before processing. Even though it was not the add comment body limit size involved in the error l am glad to know the exact limit. Thanks! |
Beta Was this translation helpful? Give feedback.
-
I’m having the same issue. How did you read the generated file back into the github-script? |
Beta Was this translation helpful? Give feedback.
-
Like this:
|
Beta Was this translation helpful? Give feedback.
-
I just ran some tests (March 31st, 2024) to see if the limit changed. I used Error: Unhandled error: HttpError: Validation Failed: {"resource":"IssueComment","code":"unprocessable","field":"data","message":"Body is too long (maximum is 65536 characters)"} So it is still, as of today, If somebody from GitHub is reading this, it'd be great if the limit was officially documented (if it already is, I completely missed it! 😳) |
Beta Was this translation helpful? Give feedback.
I found the culprit. In fact the argument too long error was caused by an environment variable passed to the github-script. The step was not even executing. I replaced it with a generated file in the previous step and just reading it back in the github-script before processing.
Even though it was not the add comment body limit size involved in the error l am glad to know the exact limit.
Thanks!