Maximum length for the comment body in issues and PR

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.

Hey there @vdesjardins :wave:

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 curl -v from your post to the createComment endpoint. Though regardless of being submitted via API, or the UI, the limits are the same.

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 curl -v to find out if you get a more appropriate error message that relates to character/size limits, or if you’re bumping up against something else.

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!

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:

Error: Argument list too long

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.

1 Like

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 Argument list too long error you provided. It’s a bit vague, but hopefully the details are helpful! :bow:

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.


1 Like

I’m having the same issue. How did you read the generated file back into the github-script?

Like this:

const fs = require("fs").promises;
var result_text = await fs.readFile("/tmp/result.txt", "utf8");