Ab initio embedded-cluster calculations are performed on the ͑CeF 8 ͒ 5− cluster embedded in BaF 2 . The local structure around the Ce 3+ impurity and the transition energies are calculated in the states of main character 4f 1 , 5d 1 , and 6s 1 , without and with spin-orbit coupling. When Madelung embedding is used, large anomalies are observed in the 5d 1 and 6s 1 manifolds. They are shown to be due to an artificial electron leak out of the cluster, at a regime of short Ce-F distances, when it occupies diffuse orbitals like the molecular orbitals of main character 5d and 6s. The main reason for the leak is the lack of linear-independency conditions between the wave functions of the cluster and its environment in Madelung embedding. When these conditions are added by means of ab initio model potential embedding ͑AIMP͒, the anomalies disappear. The 4f-5d absorption transitions calculated with spin-orbit coupling, AIMP embedding, and correlating the electrons with main character F-2s2p and Ce-4d5s5p4f5d, show good agreement with experiment. The present results support previous claims that state-of-the-art ab initio methods of quantum chemistry as the ones used here are nowadays in a position to reliably calculate 4f-5d transitions of lanthanide-doped solids. A proper embedding is crucial for this.