What version are you using? Has the site always had the problem or did it occur later on?
The version is EPiServer CMS 6 (6.0.530.0). I don't have information about how long the problem has been there, but I know for sure it has been present for the last six months.
Haven't seen the problem before and since it's near impossible to search the EPiServer Bug List it's hard to find if it's a known bug.
I bet you can get it to disappear by editing the language settings in the site and page tree. Don't think it's something in your code or something you can solve by adding code.
One good option is to upgrade to the latest version and see if that helps.
Might be you have did something like enabling one language => set that as fallback =>disabled it ?
Are you trying to reach a page that doesn't exist in that language version?
I agree with Johan, this is probably something you can work around by editing language settings on the site and is probably an EPiServer bug rather than a coding bug. Upgrading to R2 to see if that fixes it is of course an idea.
I have an issue that seems to be caused by failed language loading. When the following exception occurs the cahe key EP:LanguageBranch is empty which seems to suggest that language loading has failed and that an empty LanguageBranch collection has been cached. This brings down the entire site since the FinalFallbackCulture property counts on that there will always be at least one enabled language in the collection. An IISRESET will resolve the problem for a day or so but it comes back intermittently. Does anyone have any suggestion about what's causing this behaviour?
Exception information:
Exception type: ArgumentOutOfRangeException
Exception message: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at EPiServer.Globalization.ContentLanguage.get_FinalFallbackCulture()
at EPiServer.Globalization.ContentLanguage.DetermineCulture(LanguagePreferenceList preferenceList)
at EPiServer.Globalization.ContentLanguage.SetCulture(String priorityLanguage)
at EPiServer.Globalization.ContentLanguage.get_PreferredCulture()
at EPiServer.Web.FriendlyUrlRewriteProvider.ConvertToInternalInternal(UrlBuilder url, Object& internalObject)
at EPiServer.Web.FriendlyUrlRewriteProvider.ConvertToInternal(UrlBuilder url, Object& internalObject)
at EPiServer.Web.UrlRewriteModule.HttpUrlRewriteToInternal(UrlBuilder url)
at EPiServer.Web.UrlRewriteModuleBase.BeginRequestEventHandler(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)