Handling Errors & Warnings in R | List of Typical Messages & How to Solve


This page explains some of the most common error and warning messages in the R programming language.

Below, you can find a list of typical errors and warnings. When clicking on the bullet points of the list, you are headed to detailed instructions on how to deal with the corresponding error or warning message.

You may use the list as cheat sheet whenever you are facing an error or warning message in R.

Let’s dive into the examples!

How to Solve Error and Warning Messages in R


List of Typical Errors & Warnings in R (+ Examples)


Debugging in R – Some General Advice

Debugging in R can be a painful process. However, there are some useful tools and functions available that can be used to make the debugging more efficient.

One of these tools is the interactive debug mode, which is built into the RStudio IDE. This tool helps to find bugs by locating where the code is not working in the way you would expect, and can therefore be very helpful in case you are dealing with a more complex R code. You can read more about RStudio’s debug mode here.

Another useful method to handle errors and warnings is provided by the tryCatch function. This function can be used to check if an R code leads to an error or warning message, and it can be used to skip an error message in order to continue running the code. You can learn more about the application of the tryCatch function here.

In case you want to learn more about typical R programming error messages and the handling of these errors, you may also have a look at the following YouTube video. In the video, the speaker Andres Karjus explains some common error messages that beginners often get and how to quickly figure them out.


Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.

YouTube Content Consent Button Thumbnail

YouTube privacy policy

If you accept this notice, your choice will be saved and the page will refresh.


Note that there are usually different reasons why an error or warning message can occur. Please let me know in the comments in case the provided tips and tutorials on this page didn’t solve your problem.

Furthermore, please let me know in the comments in case the error or warning message you have problems with is not included in the previous list.

I’m looking forward to hearing from you in the comments!


Subscribe to the Statistics Globe Newsletter

Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.

10 Comments. Leave new

  • Error: grouping factors must have > 1 sampled level

  • Error in make.names(col.names, unique = TRUE) :
    invalid multibyte string at ‘

  • Hello Joachim,

    May i know what does it mean getting this warning “There were 50 or more warnings (use warnings() to see the first 50)”?
    I am running a glmm analysis with the code something like this:
    model <-glmer (richness ~ var1 + var2 + var3+(1|habitat), family = "poisson", data=xxx)

    thanks in advance

    • Hey Esther,

      This means that there have been many warnings after executing your code (i.e. more than 50). You may execute the following code to see them one-by-one:



      • Thanks Joachim,

        Now if I run my glmm models I couldn’t get the results and got another warning messages which saying like this:

        Warning messages:
        1: In vcov.merMod(object, use.hessian = use.hessian) : variance-covariance matrix computed from finite-difference Hessian is not positive definite or contains NA values: falling back to var-cov estimated from RX
        2: In vcov.merMod(object, correlation = correlation, sigm = sig) : variance-covariance matrix computed from finite-difference Hessian is not positive definite or contains NA values: falling back to var-cov estimated from RX >

        When I got that warning messages, I’ve tried running my model using glmer.nb function instead glmer.
        May I know what the difference of these two functions? Can I actually do that, I mean change the function to glmer.nb to see the influence of the variables for my study?


  • Dear Joachim

    I receive an error while I’m converting .CEL file to TXT and normalizing them :

    after using this command :
    raw.data <-ReadAffy(verbose = FALSE,filenames= f[i],cdfname="hgu133acdf")
    data.rma.norm = rma(raw.data)


    it shows :
    Error in exprs(object)[index, , drop = FALSE] : subscript out of bounds
    ,I don't know what is the cause of this error: it's bcz my data is too long or maybe a bug is in my data or some thing else,
    It will be your kindness if guide me how I can fix this error ?


Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.