Media Library: Error uploading image files, PDF files work

Topics: Administration, Troubleshooting
Feb 19, 2015 at 9:28 PM
Edited Feb 19, 2015 at 9:32 PM
When I click "import" in the media library and try to upload an image, it gets to 100% but then I get the below error returned from /Orchard.MediaLibrary/ClientStorage/Upload. PDF files and EPS files work fine - the pattern seems to be anything that would appear with a thumbnail is causing the below error somehow. Any ideas? Not sure what is up with the weird path names in the NHibernate calls, no one here has a name like "sebros".

EDIT: Forgot to mention that the file always succeeds in getting uploaded under the /media directory, so the file transfer itself is not the issue. However the file never shows up under the media library when this error occurs.
An unhandled exception has occurred and the request was terminated. Please refresh the page. If the error persists, go back

Sequence contains more than one element

System.InvalidOperationException: Sequence contains more than one element at NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Linq\DefaultQueryProvider.cs:line 111 at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Linq\DefaultQueryProvider.cs:line 35 at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression expression) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Linq\DefaultQueryProvider.cs:line 40 at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source) at Orchard.Data.Repository`1.Get(Expression`1 predicate) in z:\Builds\work\d1eb156ccc3cb14\src\Orchard\Data\Repository.cs:line 91 at Orchard.Data.Repository`1.Orchard.Data.IRepository<T>.Get(Expression`1 predicate) in z:\Builds\work\d1eb156ccc3cb14\src\Orchard\Data\Repository.cs:line 60 at Orchard.ContentManagement.DefaultContentManager.<>c__DisplayClass85.<AcquireContentTypeRecord>b__84(AcquireContext`1 ctx) in z:\Builds\work\d1eb156ccc3cb14\src\Orchard\ContentManagement\DefaultContentManager.cs:line 761 at Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in z:\Builds\work\d1eb156ccc3cb14\src\Orchard\Caching\Cache.cs:line 57 at Orchard.Caching.Cache`2.<>c__DisplayClass2.<Get>b__0(TKey k) in z:\Builds\work\d1eb156ccc3cb14\src\Orchard\Caching\Cache.cs:line 19 at System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory) at Orchard.Caching.Cache`2.Get(TKey key, Func`2 acquire) in z:\Builds\work\d1eb156ccc3cb14\src\Orchard\Caching\Cache.cs:line 17 at Orchard.Caching.DefaultCacheManager.Get[TKey,TResult](TKey key, Func`2 acquire) in z:\Builds\work\d1eb156ccc3cb14\src\Orchard\Caching\DefaultCacheManager.cs:line 33 at Orchard.ContentManagement.DefaultContentManager.AcquireContentTypeRecord(String contentType) in z:\Builds\work\d1eb156ccc3cb14\src\Orchard\ContentManagement\DefaultContentManager.cs:line 758 at Orchard.ContentManagement.DefaultContentManager.Create(ContentItem contentItem, VersionOptions options) in z:\Builds\work\d1eb156ccc3cb14\src\Orchard\ContentManagement\DefaultContentManager.cs:line 515 at Orchard.ContentManagement.ContentCreateExtensions.Create(IContentManager manager, IContent content) in z:\Builds\work\d1eb156ccc3cb14\src\Orchard\ContentManagement\ContentExtensions.cs:line 25 at Orchard.MediaLibrary.Controllers.ClientStorageController.Upload(String folderPath, String type) at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.<InvokeActionMethodFilterAsynchronouslyRecursive>b__41() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.<InvokeActionMethodFilterAsynchronouslyRecursive>b__41() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.<InvokeActionMethodFilterAsynchronouslyRecursive>b__41()
Feb 20, 2015 at 7:46 PM
I just fixed this issue for myself thanks to the clues in the stacktrace. There was an error in the database table Orchard_Framework_ContentTypeRecord, two records were named "Image". So I renamed one to "Image_2" and now I can upload images.
Oct 26 at 5:26 PM
I just had the same issue and your fix worked for me. Orchard v1.9

Thanks