Closed (fixed)
Project:
Drupal core
Version:
8.5.x-dev
Component:
node system
Priority:
Major
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
17 Dec 2017 at 17:57 UTC
Updated:
28 Mar 2018 at 04:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
cilefen commentedComment #3
timmillwoodIt'd be awesome to see a test replicating the issue.
Is it possible to replicate on a clean install of 8.4.3? or only after upgrading from 8.4.2?
How about a clean install of 8.4.2, then upgrade to 8.4.3?
Comment #4
jlsegul commentedIt only appears to happen from an upgrade from 8.4.2 to 8.4.3 on my production site. A new site I'm building with 8.4.3 doesn't have the problem.
Comment #5
jlsegul commentedI tried upgrading to 8.4.4 and the same error occurs. I tried creating a new content type and the same error occurs. Anything with the node/add/xxx path throws up this error. It really makes no sense why it would lose the ID on upgrade.
Comment #7
markasourus commentedI've run into this problem when updating from 8.3.7 to 8.4.5 also. I haven't found a solution yet.
Comment #8
berdirThis is usually a custom module/template that calls toUrl() on an unsaved entity, which is not allowed.
Enable verbose error logging which should print a backtrace, post that here.
Comment #9
markasourus commentedI updated my site from 8.3.7 to 8.4.2 without an issue. Updated to 8.5.0 when it was released. Got the same error but pointing to a different line number. Enabled verbose logging with backtrace information as described here
Here's what came back.
The website encountered an unexpected error. Please try again later.Drupal\Core\Entity\EntityMalformedException: The "node" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\Entity->toUrl() (line 189 of core\lib\Drupal\Core\Entity\Entity.php).
Drupal\pathauto\PathautoState->getValue() (Line: 140) Drupal\Core\Field\FieldItemBase->__get('pathauto') (Line: 116) Drupal\Core\Field\FieldItemList->__get('pathauto') (Line: 54) Drupal\pathauto\PathautoWidget->formElement(Object, 0, Array, Array, Object) (Line: 335) Drupal\Core\Field\WidgetBase->formSingleElement(Object, 0, Array, Array, Object) (Line: 202) Drupal\Core\Field\WidgetBase->formMultipleElements(Object, Array, Object) (Line: 104) Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 171) Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 122) Drupal\Core\Entity\ContentEntityForm->form(Array, Object) (Line: 115) Drupal\node\NodeForm->form(Array, Object) (Line: 117) Drupal\Core\Entity\EntityForm->buildForm(Array, Object) call_user_func_array(Array, Array) (Line: 514) Drupal\Core\Form\FormBuilder->retrieveForm('node_article_form', Object) (Line: 271) Drupal\Core\Form\FormBuilder->buildForm('node_article_form', Object) (Line: 48) Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 113) Drupal\node\Controller\NodeController->add(Object) call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)Comment #10
berdirThat's coming from pathauto, strange.
Make sure that you are using an up to date version of pathauto, there has not been a toUrl() call in PathautoState in a *very* long time. Not since 29.11.2015 to be exact. You need to keep your contrib modules up to date, not just drupal core, because minor versions tend to introduce changes that can break contrib modules in subtle (and sometimes not so subtle ways..)
Comment #11
markasourus commentedI usually update the contributed modules first, take a backup, and then update the core. Pathauto wasn't listed as an available update when I updated to 8.4.2. Browsing the pathauto files, I see a reference that it's for 8.x and that should be the latest version available.
Comment #12
berdirCan you post the content of the pathauto.info.yml file?
Comment #13
markasourus commentedI downloaded the latest pathauto zip file from Drupal and compared them to what I have and they aren't the same. Not sure why it wasn't listed as an available update. I attached a screenshot comparing the differences of the pathauto.info.yml files and the list of available updates as displayed from my Drupal site.
Comment #14
berdirBecause the version you had wasn't from drupal.org, you probably installed it years ago from github, Drupal didn't know how to update that as it didn't have the required information in the info.yml file.
Marking this as fixed.
Comment #15
markasourus commentedI inherited this site so it's quite possible the original developers might have gotten it from there when it was developed in Drupal 6. I'll replace it with the latest version from Drupal. Thanks for your help.
Comment #16
jlsegul commentedBased on this information, I also found out that the pathauto mod was causing my problem. The file structure of the module was different from the current zip file even though the version number was the same. Thanks for the help.