drupalerrors

كتابات: 
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7562

EntityMalformedException :خاصية الحزمة مفقودة للكينونة من نوع node . في entity_extract_ids() (السطر 7932 من ./includes/common.inc).
--

غالباً ستكون بسبب نموذج يتم إرساله بشكل مكرر مثلاً

Or custom form with a lot of custom code.
Or maybe because you are using node_form_submit().

تحديث الزميل بلال .. قد تكون أحد الاحتمالات هي بسبب استدعاء node_load لرقم نود محذوفة .. أو رقم آي دي غير صحيح ..
Bilal update .. Maybe it is because of calling node_load() of a not exists nid. or wrong nid.

تأكد من أن جميع النودات المستدعاة هي صحيحة وقد تم جلبها بطريقة صحيحة.

The Drush launcher could not find a Drupal site to operate on. Please do *one* of the following:
  - Navigate to any where within your Drupal project and try again.
  - Add --root=/path/to/drupal so Drush knows where your site is located.

http://badzilla.co.uk/drupal-7-drush-loader-and-non-composer-project
ستحتاج إلى تركيب الدرش بإستخدام
Composer
حتى لو لم يكن مشروعك يعتمد على أو لايستخدم
Composer


Warning: assert(): Cannot load a NULL ID. failed in Drupal\Core\Entity\EntityStorageBase->load() (line 249 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 265 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).


Solution: Probably you are loading a NULL as a NID or FID.
$variable = NULL;
File::load($variable);
To know the exact error please enable (All messages, with backtrace information) from (/admin/config/development/logging)
This will show you a backtrace.
When importing Drupal 7 DB in Maria DB sometimes you may get this error:
`#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'db_file.sql' at line 1`

The solution is: Skip this number of queries (for SQL) starting from the first one: 1 (instead of 0)
This error sometime happen after you doing registry rebuild for the Drupal 7 site.
`General error: 2006 MySQL server has gone away in _drupal_session_write() when max_allowed_packet is not set high enough`

The solution: Make sure to set the proper value of `max_allowed_packet` and double check the `wait_timeout` value too, you may want to increase it temporary.
  shortcut: There is content for the entity type: Shortcut link. Remove shortcut links.  
 [error]  Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization.
Entities exist of type Shortcut link and Shortcut set Default. These entities need to be deleted before importing.

The solution:
drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();'

For Drupal 9 use entityTypeManager instead:
drush ev '\Drupal::entityTypeManager()->getStorage("shortcut_set")->load("default")->delete();'
// https://www.drupal.org/project/samlauth/issues/3050122
// https://www.drupal.org/project/samlauth/issues/3232577
// Source: https://www.lullabot.com/articles/early-rendering-a-lesson-in-debugging-drupal-8
// keyword: Leaked Metadata After Cache Rebuild
// keyword: code leaked cacheability metadata
1. enable xdebug
1. set a breakpoint in the sole implementation of RendererInterface::render()
1. Look for Url::fromRoute .... usage or any Url usages, you can start with your custom code first.
1. If you are using `RedirectResponse` in hook_user_login() make sure to replace it with the `CacheableResponse` ..

----
- Do you have any code (custom module, likely) on the 'USER_SYNC' event subscriber? (Does it call Url::toString()?) Can you disable it and test if you still get the exception?
- Do you have a "Login redirect URL" configured? Does it contain a token?
- Any contrib/custom modules that you know execute code during saving the user (when its properties are synchronized)? Can you shut them off and test if you still get the exception?
- You're likely looking at a Url::toString() call; those are 'magic' and do stuff in the background which may cause the exception in the end.
- It's not only Url::toString() which can have this effect but this is very often the

Drupal\Core\Entity\EntityStorageException: Entity validation was skipped. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() 

- You are probably overriding the default validateForm callback.
// NOTE: It might be because of validate callbacks order.
// If you are using $form['actions']['submit']['#validate'] ... try to use $form['#validate'] instead to allow Drupal validate to work before you.
ERROR: Entity validation was skipped
---
You need to call: parent validation function or you can do on your responsibility:

$form_state->setTemporaryValue('entity_validated', TRUE);

// Custom form contain AJAX callbacks and File ... once you upload a file the values coming from AJAX callbacks is missing.

      // Due some issue with missing tree values in form_state when upload files using managed_file type.
      // We will save the value in the form_state directly to avoid this issue.
      // This issue causing this field value to be disappeared on submitted values.

if ($form_state->getValue(['info', 'name'])) {
  $form_state->set('info_name', $form_state->getValue(['info', 'name']));
}
// Database import failed: ERROR 1273 (HY000) at line 25: Unknown collation: 'utf8mb4_0900_ai_ci' Import failed: 
sed -i 's/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g' YOUR_FILENAME.sql
/**
 [error]  Drupal\Core\Config\ConfigException: Errors occurred during import in Drush\Drupal\Commands\config\ConfigImportCommands->doImport() (line 304 of /app/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php).
In ConfigImportCommands.php line 318:
The import failed due to the following reasons:
  Unexpected error during import with operation delete for node.type.page: Attempted to create an instance of field with name body on entity type node when the field storage does not exist.
  Unexpected error during import with operation delete for contact.form.personal: Attempted to create an instance of field with name body on entity type node when the field storage does not exist.
  Unexpected error during import with operation delete for contact.form.feedback: Attempted to create an instance of field with name body on entity type node when the field storage does not exist.
  Unexpected error during import with operation delete for comment.type.comment: Attempted to create an instance of field with name body on entity type node when the field storage does not exist.
  Unexpected error during import with operation delete for block_content.type.basic: Attempted to create an instance of field with name body on entity type node when the field storage does not exist.
  Unexpected error during import with operation delete for field.field.node.article.body: Attempted to create an instance of field with name body on entity type node when the field storage does not exist.
  Unexpected error during import with operation delete for taxonomy.vocabulary.tags: Attempted to create an instance of field with name body on entity type node when the field storage does not exist.
  Unexpected error during import with operation delete for field.field.node.article.comment: Attempted to create an instance of field with name comment on entity type node when the field storage does not exist.
  Unexpected error during import with operation delete for node.type.article: Attempted to create an instance of field with name body on entity type node when the field storage does not exist.

  Unexpected error during import with operation delete for field.field.comment.comment.comment_body: Attempted to create an instance of field with name comment_body on entity type comment when the field storage does not exist.  
*/

when install a website from configuration or import a configuration in a website.

// SOLUTION:
// You need to delete the field node body storage before importing the config
// So, you need to run this command:
// CAUTION: Please be aware that the data inside this body field will be lost. use this command for new installations only!
drush ev '$f = \Drupal\field\Entity\FieldStorageConfig::loadByName("node", "body"); if($f) $f->delete();'
/**
BadMethodCallException: The "..." method is not callable as a _custom_access callback in route "/...." in Drupal\Core\Access\CustomAccessCheck->access() (line 69 of core/lib/Drupal/Core/Access/CustomAccessCheck.php).
*/

Review the access class implementation and make sure it implements AccessInterface. Or at least review the custom parameters in the route itself.
// Common errors
If it happend that the PECL oauth failed. sh: 1: phpize: not found ERROR: phpize failed you will need to install php-dev sudo apt install php-dev
configure: error: Couldn't find pcre.h, try installing the libpcre development/headers package & ERROR: /tmp/pear/temp/oauth/configure --with-php-config=/usr/bin/php-config' failed`
Update git remote using SSH connection git remote set-url origin [email protected]:group/project.git
fatal: Need to specify how to reconcile divergent branches. You need to merge your local commit with the latest changes with no rebase using this command git pull --no-rebase
method is not callable as a _custom_access callback in route  .. Make sure the namespace of the custom access callback is correct. Try to checn the _custom_access to any other working callbacks to get more helpful errors.
Docker network conflict with Gitlab: ip addr and look for network starting with 192.x.x.x then docker network rm HASH_OF_NETWORK then lando rebuild RESOURCE: https://www.lullabot.com/articles/fixing-docker-and-vpn-ip-address-conflicts
Database import failed: ERROR 1273 (HY000) at line 25: Unknown collation: 'utf8mb4_0900_ai_ci' Import failed: sed -i 's/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g' YOUR_FILENAME.sql
// ERROR:   Resolve all issues below to continue the installation. For help configuring your database server, see the installation handbook, or contact your hosting provider.
  • The database server version 5.5.68-MariaDB is less than the minimum required version 10.3.7.
web/core/lib/Drupal/Core/Database/Install/Tasks.php
mod_fcgid: HTTP request length 138280 (so far) exceeds MaxRequestLen (131072)

// nano /home/content/conf/web/DOMAIN_NAME.httpd.conf
// Before the `` you can add these 3 lines

FcgidMaxRequestLen 2000000


// then
service httpd reload
requires php ^5.6.0|^7.0 -> your php version (8.1.18) does not satisfy that requirement.
lando composer require drupal/bootstrap5 --ignore-platform-req=php
// No logs for the error, and on error.log file showing these lines:
Premature end of script headers: index.php
AH01070: Error parsing script headers
AH01075: Error dispatching request to :

// Solution:
There is no specific solution for this issue, you need to dig deep to get error lines
Some devs mention that this might be related to folder permissions, or because of multiple PHP versions on same server leading to run part of the script using a version and the other part with a different version (because of miss configuration)
For me, I had to trace the process and at the last output lines of the process I got where it failed at and I was able to (guess) the issue. For my issue it was because I was enabling the debug mode (The Twig files was outputting a big giant of code out there). so, I disabled the development services.yml file and the website worked fine.

// Resources:
https://stackoverflow.com/a/42141389/366884
Drupal\Component\Serialization\Exception\InvalidDataTypeException: /app/web/modules/custom/custom.links.menu.yml: A colon cannot be used in an unquoted mapping value at line 1 (near "custom.settings:
 route_name: book.settings
 title: 'Settings'
 base_route: book.admin
 weight: 100
"). in Drupal\Core\Discovery\YamlDiscovery->decode() (line 24 of core/lib/Drupal/Core/Discovery/YamlDiscovery.php).

// Move your route definition from this module to any other module that has a working .links.menu.yml file.
// Sometimes you may need to rebuild menu links
    \Drupal::service('plugin.manager.menu.link')->rebuild();
    \Drupal::service('router.builder')->rebuild();
    \Drupal::service('plugin.manager.menu.link')->rebuild();

فضلاً إذا أعجبتك هذه الصفحة لاتنسى أن تقوم بمشاركتها