Update existing 'aggregator_feed' entity while changing the ID is not supported.

Created on 15 March 2023, almost 2 years ago
Updated 27 August 2023, over 1 year ago

Problem/Motivation

Getting Issue on cron run.

Steps to reproduce

Setup some feeds using aggregator module. it will create some items on cron run.
But gives error on while updating existing items.

Drupal\Core\Entity\EntityStorageException: Update existing 'aggregator_feed' entity while changing the ID is not supported. in Drupal\Core\Entity\ContentEntityStorageBase->doPreSave() (line 762 of /home/mdslearn/public_html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php).

Proposed resolution

Any patch to fix issue are welcome.

Thanks

🐛 Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇮🇳India AnokR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @AnokR
  • Status changed to Postponed: needs info almost 2 years ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    That error looks like it is trying to update a feed, not an item

    Can you provide more detail - e.g. steps to reproduce starting from 'Install Drupal'

  • 🇮🇳India AnokR

    @larowlan, Thanks for your quick reply.
    FYI:- I'm using Opigno LMS 3 using composer create project. With some customised configuration.
    Now I have enabled the core aggregator module and added around 25 feeds.
    The feeds are created successfully and on cron ran It fetched some data. But again when cron run it gives errors in the recent log page with the same error

     Drupal\Core\Entity\EntityStorageException: Update existing 'aggregator_feed' entity while changing the ID is not supported. in Drupal\Core\Entity\ContentEntityStorageBase->doPreSave() (line 762 of /home/mdslearn/public_html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php).
    

    However, The error is not related aggregate module file but it's related with feed.
    If you can replicate that would be good.

    Thanks!

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Any chance you could get a full stack trace?

  • 🇺🇸United States dcam

    I got this same error while trying to reproduce 🐛 Deleted and edited aggregator feeds are restored from queue Fixed . In that other issue, cron runs are (or were) broken because of deleted feeds. Aggregator stores the entire feed object in the queue. But if a feed is queued for update, then deleted before the queue is run, this error is thrown when the queue eventually does run. Here are the steps that I used when trying to reproduce the other issue:
    1. Create a new feed.
    2. Execute the following command with Drush: drush eval '$queue = \Drupal::queue("aggregator_feeds");$feed = \Drupal\aggregator\Entity\Feed::load(1);$queue->createItem($feed);'. Make certain that you replace the ID in the Feed::load() statement with the ID of your feed.
    3. Delete the feed you just created.
    4. Execute the following command with Drush: drush queue:run aggregator_feeds

    After that, I got this error on the command line:

     [error]  Drupal\Core\Entity\EntityStorageException: Update existing 'aggregator_feed' entity while changing the ID is not supported. in Drupal\Core\Entity\ContentEntityStorageBase->doPreSave() (line 762 of C:\wamp\www\drupal10\web\core\lib\Drupal\Core\Entity\ContentEntityStorageBase.php).
     [error]  Update existing 'aggregator_feed' entity while changing the ID is not supported.

    So that's the reason for the confusing error: it's trying to update an entity that doesn't exist. Thus, I think that this issue may be a duplicate of #1067532.

    @AnokR, you can potentially solve this problem by purging the aggregator_feeds queue by one of two ways:
    * Execute this command with Drush: drush queue:delete aggregator_feeds
    * Execute this query on your database: DELETE FROM queue WHERE name = 'aggregator_feeds';

  • 🇬🇧United Kingdom jfk_research

    Confirming that running drush queue:delete aggregator_feeds as suggested in #5 solved the same problem for us.

    We had these errors because a feed was deleted while trying to solve an issue with a very large feed that was temporarily stopping cron from running. When the issue with the large feed was solved and cron started running again, lots of Update existing 'aggregator_feed' entity while changing the ID is not supported error messages appeared in the logs after each cron run.

  • Status changed to Closed: duplicate over 1 year ago
  • 🇺🇸United States dcam

    I'm going to go ahead and close this as a duplicate of 🐛 Deleted and edited aggregator feeds are restored from queue Fixed . I was leaving it open to help anyone else who might have the problem since we haven't released a new version with the fix. But to be honest I'm tired of seeing it in the queue while I'm looking for something to work on.

Production build 0.71.5 2024