Getting error "Validation failed for one or more entities" after setting up Project

Hi,

first of all thanks for this great tool, it looks like exactly the kind of thing we’re looking for.
However, I’m running into an issue after creating a project.

After installing (Windows Server 2008, SQL Server 2005), I can view the Octopus website and create an Environment, Machine, connect to Nuget feed.
However, after I create a Project, I now only see this for most of the webpages (home page, /Environments, /Projects):

{
“errors”: [
“Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.”
]
}

So I’m not seeing a webpage at all any more, just what looks like a json snippet.
Is it an issue that I’m running SQL Server 2005 instead of SQL Server 2008 Express?

Thanks!

To give some more info, here are some errors from the Windows event log
(some are to do with the tentacle healthcheck failing, which I’m guessing may be a security or firewall issue, although I can see the machine’s health service .svc and some seem to do with the EntityFramework entity for the Task not validating I’m guessing):

2012-01-10 08:22:14,297 [9] ERROR Octopus [(null)] - An unexpected error occurred while attempting to retrieve and execute a task: Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.
System.Data.Entity.Validation.DbEntityValidationException: Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.
at System.Data.Entity.DbContext.SaveChanges()
at Octopus.Core.Persistance.UnitOfWork.Within(Action action) in c:\BuildAgent\work\93ea602cb1d1c3f2\source\Octopus.Core\Persistance\UnitOfWork.cs:line 62


Exception information:
Exception type: DbEntityValidationException
Exception message: Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.
at System.Data.Entity.DbContext.SaveChanges()
at Octopus.Core.Persistance.UnitOfWork.Commit() in c:\BuildAgent\work\93ea602cb1d1c3f2\source\Octopus.Core\Persistance\UnitOfWork.cs:line 34
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)


2012-01-10 08:17:07,728 [10] WARN Octopus [(null)] - Outstanding Tentacle health check tasks were not completed before the next round of health checks was scheduled. If this error persists, please post on http://help.octopusdeploy.com to let us know this is a problem for you.


2012-01-10 08:05:58,716 [22] ERROR Octopus [(null)] - System.ServiceModel.CommunicationObjectAbortedException: The communication object, System.ServiceModel.Channels.ReliableRequestSessionChannel, cannot be used for communication because it has been Aborted.

Server stack trace:
at System.ServiceModel.Channels.InterruptibleWaitObject.Wait(TimeSpan timeout, Boolean throwTimeoutException)
at System.ServiceModel.Channels.ReliableRequestor.Request(TimeSpan timeout)
at System.ServiceModel.Channels.ClientReliableSession.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ReliableRequestSessionChannel.OnOpen(TimeSpan timeout)

Here is an entry from the event log for ASP.Net:

Exception type: DbEntityValidationException 
Exception message: Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.

at System.Data.Entity.DbContext.SaveChanges()
at Octopus.Core.Persistance.UnitOfWork.Commit() in c:\BuildAgent\work\93ea602cb1d1c3f2\source\Octopus.Core\Persistance\UnitOfWork.cs:line 34
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)

And here are some entries with source Octopus:

2012-01-10 08:22:14,297 [9] ERROR Octopus [(null)] - An unexpected error occurred while attempting to retrieve and execute a task: Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.
System.Data.Entity.Validation.DbEntityValidationException: Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.
at System.Data.Entity.DbContext.SaveChanges()
at Octopus.Core.Persistance.UnitOfWork.Within(Action action) in c:\BuildAgent\work\93ea602cb1d1c3f2\source\Octopus.Core\Persistance\UnitOfWork.cs:line 62
at Octopus.Server.Tasks.TaskQueue.ExecuteNextTask() in c:\BuildAgent\work\93ea602cb1d1c3f2\source\Octopus.Server\Tasks\TaskQueue.cs:line 89

2012-01-10 08:17:07,728 [10] WARN Octopus [(null)] - Outstanding Tentacle health check tasks were not completed before the next round of health checks was scheduled. If this error persists, please post on http://help.octopusdeploy.com to let us know this is a problem for you.

Hi Remco,

Good question, I haven’t tested against SQL 2005.

Is it possible for you to install 2008 temporarily? I’ll see what I can do about SQL 2005 compatibility later tonight.

Paul

Hi Paul,

I’ve installed SQL 2008 Express and created a new database.
I’m pretty sure it’s using the new database (I can see rows appearing in octopus.environment when I create an Environment) but it’s throwing an error when I create a Project and then go to View it.
I get this error:
{
“errors”: [
“An error occurred while executing the command definition. See the inner exception for details.”
]
}
so a web page that is just a json snippet.
I’m seeing some errors around Tentacle aliveness check failure in the event log, e.g.:

2012-01-10 21:22:03,299 [9] ERROR Octopus [(null)] - An unexpected error occurred while attempting to retrieve and execute a task: Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.
System.Data.Entity.Validation.DbEntityValidationException: Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.

And the one server I’ve added to Machines (which does have a Tentacle running and which I can connect to using a browser to the :10933) is showing as Offline.

After I’ve created the database I had to manually add the NT Authority\Network Service account as dbowner to the Octopus database I’ve created, that’s not mentioned in the installation guide so I wonder if I’m doing something wrong.

Cheers,

Remco

Hi Remco,

Are you able to create a backup of your database, and upload or email me (paul@paulstovell.com) the .bak? I can’t reproduce it locally

Paul

Hi Paul,

here is the backup.

Cheers,

Remco

Octopus.bak (1 MB)

Hi Paul,

I figured it out I think. I had an old version of the EntityFramework.dll in my GAC, which it was using in preference to the one that is bundled with the Portal. After deleting that stuff started working.
Sorry for the red herrings.

Cheers,

Rem

Hi Remco,

Thanks a lot for letting me know. This is good to know because it’s something I should probably check for in the installer. Thanks!

Paul

To get into the real issue you will have to catch the DbEntityValidationException exception and dig into the issue details. Here is a readymade catch block to get into the real issue that throws this exception from the entity framework.