[Tex/LaTex] Package natbib Error: Bibliography not compatible with author-year citations

bibtexerrorsnatbib

I have a basic tex file and a bibliography which is exported from Mendeley

However, when I want to cite in the author-year style, I get the error:

Package natbib Error: Bibliography not compatible with author-year citations.
(natbib) Press <return> to continue in numerical citation style.

Any clue what's wrong?

Minimum working example:

\documentclass[letterpaper, 10pt]{article}

\usepackage[authoryear]{natbib}
\usepackage{lipsum}

\begin{document}

\lipsum[1-4]
\nocite{*}

\bibliographystyle{apalike}
\bibliography{articles}

\end{document} 

A snippet of my .bib library:

@article{shortcode,
author = {Lastname, Firstname},
file = {:/path/to/file.pdf:pdf},
journal = {Journal name},
number = {xx},
pages = {x--xx},
title = {Title},
volume = {xx},
year = {xxxx}    
}

Best Answer

Another way this error can arise is if one of your BibTeX entries has no year.

To find out which entry it is, look earlier in the output for a message like Warning--empty year in ABC2019. So check ABC2019.

Related Question