Chapter 3 Bug Tracking
3.1 What is a bug in R?
You may find a bug in R if:
- The R session terminates unexpectedly, or there is a segmentation fault, it might be a bug in R, unless you have written your own call to compiled code or an internal function (via
.Internal). The error may look like this:
- If the code does not do what the documentation says it should, then either the code or the documentation is wrong. Report either of which needs to be fixed.
Note: When you are in doubt that there is a bug: (which should be most of the time!)
Make sure whether the bug appears in a clean session of R. Many times, there are variables/commands/functions stored in history which might cause issues. Hence, check if the issue happens in a clean session. To do so, launch R from the command line with the
At times the code that is written is very complicated, has numerous package and file dependencies, has many function calls, etc.. In such scenarios it is quite common that the code throws an error and you are not able to solve it. You may tend to think that there is a bug that needs to be reported. Before doing so, try to produce a minimum working example of the code for the section where the error occurred. Add only those package and files which are required by that section, and see if the error appears still. Using this approach shall solve most of the errors.
Search on R-devel email list for messages with keywords related to your possible bug. If you find some related messages then read them to see if they clarify whether or not it is a bug. If you do not find any related messages, then please post a new message to R-devel. Your message should include (1) a brief description of the bug including current and expected behavior, (2) a minimal reproducible example.
3.2 What condition might not be a bug?
In case the code is doing something unexpected, it may not necessarily be a bug. Carefully review the documentation of the function being called, and check whether the behaviour being exhibited on calling this function is the same as it was designed to do.
Issues with seemingly identical numbers not being equal (especially floating point numbers) are usually not bugs.
If R is running slower than expected, then also it may not be a bug. Ask someone else to review your code in such a case.
If some function is working, but it is not defined in the best generalised way, then consult someone to look over your code. This may perhaps not be a bug; instead, it might be an alternative way of writing the function.
3.3 Checking if a bug is already reported
The first step before filing a bug report is to see whether the problem has already been reported. Checking if the bug is reported will:
Save time for you and the developers
Help you see if the bug is already fixed for the next release
Lead you to learn what needs to be done to fix it
Determine if any additional information is needed
The sections that follow discuss where to check whether a bug is already reported.
3.4 Levels of contributing to bug / What do you do when you find a bug?
3.5 What are some places where you may find a bug?
You may find a bug in:
3.6 How to report a bug?
Once you confirm a bug exists, you need to submit a bug report so that it gets fixed.
3.6.1 Bug in the R-Core supported packages, their documentations, and/ or in the R language
Packages that are supported by the R-Core are labelled with
Maintainer: R Core Team <Remail@example.com>. One simple way to get the information from R is by running the
The bug report for R-Core supported packages, their documentations, and/ or a bug report for the R language itself can be submitted either to R-devel, see posting guide, or to Bugzilla. In the future, we hope to have an option to report an issue to the GitHub Mirror of R svn server.
If you want to submit the bug report using Bugzilla, please ensure that you have a Bugzilla account. To get a Bugzilla account, please send an e-mail to
firstname.lastname@example.org the address that you want to use as your login. In this e-mail, briefly explain why you need an account. A volunteer shall then create a Bugzilla account and add you to R’s Bugzilla members.
Please ensure whether the bug is already fixed (in the upcoming changes in R) or reported (search for it from those already reported on Bugzilla, either on search existing bug reports, may use the advanced search option here, or show open bugs new-to-old).
3.6.2 Bug in the non R-Core supported packages and/or their documentations
For packages that are not maintained by the R-Core, the bug reports can be submiited at, perhaps, an issues tracker url on GitHub/GitLab/R-Forge. To find if such an issues tracker is available, you can look at the package
DESCRIPTION file first (e.g. using
packageDescription("package_name")) to check if a url is provided in the
BugReports field. If that is not available, then the package maintainer can be contacted (using
maintainer("package_name")). In R running the function
bug.report(package = "package_name") shall direct you to either the GitHub issue tracker of the package, or to the bug tracking web page, or towards composing an e-mail to the package maintainer. This function
bug.report is disabled in RStudio, by default. However, if you use
utils::bug.report(package = "package_name") then it works on RStudio as well. Please ensure that the bug is not already reported or fixed before reporting it in any of the ways suggested above.
3.7 Good practices in reporting bugs / Expectations of a good bug report
If you follow the practices given below, you will come up with a good bug report which might make it easier for the maintainer(s) to fix the bug.
Include a minimal reproducible example of the bug in your report. The maintainer should be able to quickly reproduce the bug on using the minimal example that you provide. Here is a community wiki post on how to make a minimal reproducible example.
Mention the software architecture on which the bug occurred.
Use inbuilt data sets as far as possible.
Once you have successfully reported a bug, you will likely receive an update each time an action is taken on the bug. On Bugzilla, the report may be given one of the following status: New, Assigned, Confirmed, Reopened, Unconfirmed.
3.8 Disagreement with a resolution on the bug tracker
As humans, there might be differences of opinions from time to time. What needs to be considered here is that, being respectful of the fact that care, thought, and volunteer time has gone into the resolution of the issue or bug.
If you take some time, then on reflection, the resolution steps may seem more reasonable than you initially thought. If you still feel that the resolution is incorrect, then raise a thoughtful question to the person who resolved it. If the issue was carefully thought about in the first place then is less likely to win any conversion of thought.
As a reminder, issues closed by a core developer on Bugzilla have already been carefully considered. Please do not reopen a closed issue. Although one can comment on a closed issue, if necessary. Every comment on an issue generates an email to every R-core member (unless they have the notifications disabled). So it would be best to be considerate while commenting on issues, especially in case of the closed issues or when you are commenting in pure agreement without adding anything beyond that to a discussion (the +1 type posts which are perfectly acceptable in other contexts).
3.9 Examples of Bug reports submitted on Bugzilla or R-devel mailing list
If you like to see how bugs are reported on Bugzilla, here are some examples:
A bug report with a reproducible example, a patch, and a review.
A substring bug reported by Toby Dylan Hocking and fixed by Tomas Kalibera, Feb 2019 via the R-devel mailing list.
A gregexpr bug report and patch submitted by Toby Dylan Hocking and merged by Tomas Kalibera, Feb 2019 via the R-devel mailing list.