impossible to upgrade to version 4.40 from 4.30 Setup failed: Sequence contains more than one element

6 months ago
I have spent 15 hours so far if not what appears to be an entire lifetime....

I have an old 3.9 installation which I was able to bring up to 4.30 and get it running perfectly.

But trying to upgrade to 4.40 always always always fails with this message: Setup failed: Sequence contains more than one element

I have tried everything. From top to bottom I have even did this:

Created a new install of 4.30 with brand new empty database with NO sample products. Then I ran the application and UNINSTALLED and DELETED all the plugins (empty collection of 'InstalledPlugins' in the plugins.json file...

Then in the 4.40 I also emptied the collection of 'InstalledPlugins' in the plugins.json file and ran the install -> pointed to my newly created 4.30 database and got the exact same result: Setup failed: Sequence contains more than one element

I have tried every thing in between trying to upgrade to my own 4.30 database with my products in it, then same thing without plugins....

Every possibilities have been explored, I even tried commenting out some migrations... and have always resulted in the same result: Setup failed: Sequence contains more than one element

I have made at least 25 different attempts with different parameters..

I am able to do a brand new install of 4.40 with its own brans new database...

but it cannot be upgraded...

where does that message come from anyway?
6 months ago
also I want to add that when trying to just copy over the dataSettings.json file from ANY of my 4.30 experiments to ANY of my other 4.40 experiments: this ALWAYS results in the app issuing "too many redirects" and then we get to a browser based standard error page stating the error and suggesting to "clear my cookies" which did NOT work....

6 months ago
Do you have any custom tables, or added any custom fields to existing tables?

Please post the entire error message here.
6 months ago
Hi New York. Thanks for the reply.

As I had mentioned in my post: I did try a brand new install of 4.3 which created its own empty database, and this database..... even this one I am not able to upgrade to 4.40.

If I run the setup and point to the 4.30 database I get this error message: Setup failed: Sequence contains more than one element

If I simply copy over the dataSetings.json from the 4.30 project to the 4.40 project: It gets caught in a loop of redirects.

The error message I get is: Setup failed: Sequence contains more than one element

6 months ago
it appears to be redirecting to the non secured http version of the site...

here is the request:

GET https://localhost:44369/ HTTP/1.1
Host: localhost:44369
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
sec-ch-ua: "Google Chrome";v="95", "Chromium";v="95", ";Not A Brand";v="99"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: .Nop.Customer=c5d53ab8-3ea9-4bb2-97ca-c744baf8f35a

and the response

HTTP/1.1 301 Moved Permanently
Transfer-Encoding: chunked
Location: http://localhost:44369/
Server: Microsoft-IIS/10.0
Set-Cookie: .Nop.Customer=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/
Set-Cookie: .Nop.Customer=c5d53ab8-3ea9-4bb2-97ca-c744baf8f35a; expires=Sun, 13 Nov 2022 03:21:47 GMT; path=/; secure; httponly
X-MiniProfiler-Ids: ["188bd6c8-a8d2-4d48-8748-6e456426c5f7"]
X-SourceFiles: =?UTF-8?B?Qzpcd29ya1xub3Bjb21tZXJjZV80XzQwX2FkYXB0XHNyY1xQcmVzZW50YXRpb25cTm9wLldlYg==?=
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Security-Policy: default-src 'self'; connect-src *; font-src * data:; frame-src *; img-src * data:; media-src *; object-src *; script-src * 'unsafe-inline' 'unsafe-eval'; style-src * 'unsafe-inline';
Referrer-Policy: same-origin
Permissions-Policy: accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=*, usb=()
Date: Sat, 13 Nov 2021 03:21:47 GMT

6 months ago
Regarding Sequence contains more than one element,
It means that "The problem is that you are using SingleOrDefault. This method will only succeed when the collections contains exactly 0 or 1 element. I believe you are looking for FirstOrDefault which will succeed no matter how many elements are in the collection."
In nopCommerce v4.40, it is being used at Nop.Data.Mapping.FluentMigratorMetadataReader
Where the GetAttribute method is trying to use your provided column name map at MappingBuilder via NameCompatibilityManager. It's expecting to have one mapping for one column definition but getting more than one.
In short the meaning of it is, You provided more than one map for same column at least one of your mapping entity builder class.
For example: Providing Map for CustomerId twice


And for, SSL redirection, Check your store URL & when you are in visual studio check Web Server Setting too.
6 months ago
I don't think you can "run the setup and point to the 4.30 database", because the tables already exists.

After you install a new 4.30, which will create empty 4.30 DB, copy these files from 4.30 folder to the 4.40 folder
\App_Data\  dataSettings.json, plugins.json, appsettings.json

How did a brand new 4.30 install get SSL settings?  If they are there, then I suggest you first update the DB Store table so that you can run the 'upgrade' not secure - e.g.

UPDATE [Store]
   SET [Url] = 'http://localhost:44369/'  
      ,[SslEnabled] = 0
6 months ago
I have resolved the issue. I am have successfully upgraded my existing store to 4.40.4

6 months ago
bcweed wrote:
I have resolved the issue. I am have successfully upgraded my existing store to 4.40.4

What was the issue and how did you solve that?
Please share in the forum to help others.