# Package natbib Error: Bibliography not compatible with author-year citations

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}
}

-
 I also get the error, but my PDF still gets rendered fine. All my library entries have a year and I deleted temporary files several times. So, I ignore it for now. I found out that this command always gets into the aux file: \providecommand\NAT@force@numbers{}\NAT@force@numbers – OneWorld Aug 22 '12 at 10:15

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

-
 That was indeed the case Josh. Tnx – grrrbytes May 31 '12 at 8:03

When changing the bibliography style, sometimes natbib is upset because it can't interpret the data correctly.

In any case, after changing the argument to \bibliographystyle a run of LaTeX and one of BibTeX are necessary to get back in sync. Removing the .bbl and .aux files before those run is recommended, in order to avoid spurious error messages that might corrupt the .aux file currently being generated.

-
A vote here to remove all the temporary files- it does not seem like just the bbl+aux was enough (though I was tearing my hair out so I may not have been of entirely sound mind). Anyway- temporary files- they'll get ya. – Brandon Kuczenski Jun 2 '12 at 0:04
This fixed my problem! – Earl Bellinger Dec 8 '12 at 19:14

I had the same error trying to use spmpsci.bst in conjunction with natbib. While natbib's default citation style is author-year, spmpsci.bst is numeric, so this is a strange error to get. I eventually changed the following:

\usepackage[square,sort,comma]{natbib}


to

\usepackage[square,sort,comma,numbers]{natbib}


Problem went away.

-
 Terrific solution, thanks! – Xi'an Apr 9 at 11:43