Error evaluating the log probability at the initial value

The way the sampler proposes possible values from the posterior distribution is a separate process, and can have absolutely nothing to do with what prior distributions you put on parameters.

When you declare a parameter:

parameters {
  real <upper = 5> a_parameter;
}

You are declaring that a_parameter has support (-\infty, 5], and Stan will the propose values from within that support. If you then put a lognormal prior on a_parameter, you need to match the declared bounds on the parameter with the support of the prior.