The reply of Dimitry can be enough. However I suppose that your question come from one "rule" frequently used in Econometrics books. Then, briefly, if some included regressors and error term are correlated we have endogeneity problem. Unfortunately some presentation do not underscore effectively what kind of "error term" are involved in this "rule".
We can intend it as the "true error term", the error term of the true model. The exogeneity assumption for OLS come from here.
Alternatively we can intend this "error term" as the error term of the misspecified model, where the misspecification can appear clearly only if the true model is known.
In real world this error term is an unobservable quantity. What you observe are the "residuals", related but different things. From residuals only we cannot discover endogeneity, in fact in OLS framework exogeneity is an untestable assumption.
EDIT: Just a warning. The problem of endogeneity (then exogeneity) is of tremendous importance in econometrics and can be write down in various version. Even for this reason the debate, and sometimes confusion, about those concepts is common. In my view concepts like endogeneity (then exogeneity) must be always related to causality and, therefore, structural concepts. I wrote something about that in this site, see here for instance:
endogenous regressor and correlation
Regression and causality in econometrics
Endogeneity in forecasting
Keeping aside the above aspects. Here I limit myself to suppose what sabiste had in his mind when wrote his question. In econometrics presentations is common to take back various problem like: omitted variables, simultaneity, measurement errors; to endogeneity problem. Shortly, endogeneity imply biasedness in some parameters.
In the "rule" the correlation between errors and included regressors are indicated as the core of the problem; the trace of him. We can read Wikipedia also:
If the independent variable is correlated with the error term in a regression model then the estimate of the regression coefficient in an ordinary least squares (OLS) regression is biased; however if the correlation is not contemporaneous, then the coefficient estimate may still be consistent.
at least at general level, no other conditions are added.
I suppose that sabiste conflated the role of residuals with that of error terms intended as clarified above. Common mistake among neophyte.