Title: Error (replaceChild() on null)
Last modified: February 8, 2023

---

# Error (replaceChild() on null)

 *  Resolved [turtle0114](https://wordpress.org/support/users/turtle0114/)
 * (@turtle0114)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/error-replacechild-on-null/)
 * This is the message shown on my screeen
 *     ```wp-block-code
       Call to a member function replaceChild() on null (0) [Error]
       /var/www/vhosts/cbseanswers.com/theinclouder.in/wp-content/plugins/amp/includes/sanitizers/class-amp-img-sanitizer.php:117
   
       #0 /var/www/vhosts/cbseanswers.com/theinclouder.in/wp-content/plugins/amp/includes/sanitizers/class-amp-img-sanitizer.php(129): AMP_Img_Sanitizer->process_picture_elements()
       #1 /var/www/vhosts/cbseanswers.com/theinclouder.in/wp-content/plugins/amp/includes/templates/class-amp-content-sanitizer.php(147): AMP_Img_Sanitizer->sanitize()
       #2 /var/www/vhosts/cbseanswers.com/theinclouder.in/wp-content/plugins/amp/includes/class-amp-theme-support.php(2032): AMP_Content_Sanitizer::sanitize_document()
       #3 /var/www/vhosts/cbseanswers.com/theinclouder.in/wp-content/plugins/amp/includes/class-amp-theme-support.php(1750): AMP_Theme_Support::prepare_response()
       #4 [internal function]: AMP_Theme_Support::finish_output_buffering()
       #5 /var/www/vhosts/cbseanswers.com/theinclouder.in/wp-includes/functions.php(5279): ob_end_flush()
       #6 /var/www/vhosts/cbseanswers.com/theinclouder.in/wp-includes/class-wp-hook.php(308): wp_ob_end_flush_all()
       #7 /var/www/vhosts/cbseanswers.com/theinclouder.in/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
       #8 /var/www/vhosts/cbseanswers.com/theinclouder.in/wp-includes/plugin.php(517): WP_Hook->do_action()
       #9 /var/www/vhosts/cbseanswers.com/theinclouder.in/wp-includes/load.php(1124): do_action()
       #10 [internal function]: shutdown_action_hook()
       #11 {main}
       ```
   
 * what can be done for this any help will be amazing
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ferror-replacechild-on-null%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Support [Milind More](https://wordpress.org/support/users/milindmore22/)
 * (@milindmore22)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/error-replacechild-on-null/#post-16451864)
 * Thank you for contacting us, it seems you are using a invalid `<picture>`element
   on your site which is resulting in above fatal error.
 * Your picture element for Author photo looks like below
 *     ```wp-block-code
       <picture>
         <source type="image/webp" data-srcset="https://www.ofuxico.com.br/wp-content/uploads/2022/08/autor-vini.jpg.webp">
         <img style="max-width: 80px;" data-eio="p" src="https://www.ofuxico.com.br/wp-content/uploads/2022/08/autor-vini.jpg" decoding="async" class="lazyload">
         <noscript>
           <img decoding="async" src="https://www.ofuxico.com.br/wp-content/uploads/2022/08/autor-vini.jpg" style="max-width: 80px;" data-eio="l">
         </noscript>
       </picture>
       ```
   
    1. the `<source>` doesn’t have `srcset` instead, it has `data-srcset` which is 
       not valid.
 * 2. `<noscript>` is not allowed as child of `<picture>` element also we found 
   duplicate `<img>` as child of `<noscript>` which might be the reason for the 
   fatal error as AMP plugin is trying to replicate picture element with `<amp-img
   >` tag but since it found two child `<img>` tag creating a fatal error.
 * Please replace the <picture> tag with following
 *     ```wp-block-code
       <picture>
         <source type="image/webp" srcset="https://www.ofuxico.com.br/wp-content/uploads/2022/08/autor-vini.jpg.webp">
         <img style="max-width: 80px;" data-eio="p" src="https://www.ofuxico.com.br/wp-content/uploads/2022/08/autor-vini.jpg" decoding="async" class="lazyload">
       </picture>
       ```
   
 * it should fix your issue.
 *  Thread Starter [turtle0114](https://wordpress.org/support/users/turtle0114/)
 * (@turtle0114)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/error-replacechild-on-null/#post-16452366)
 * i am unable to locate that and have no idea how to remove it
 *  Thread Starter [turtle0114](https://wordpress.org/support/users/turtle0114/)
 * (@turtle0114)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/error-replacechild-on-null/#post-16452386)
 * and its happning on every AMP page even those who dosent have <picture> tag
 *  Plugin Support [Milind More](https://wordpress.org/support/users/milindmore22/)
 * (@milindmore22)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/error-replacechild-on-null/#post-16452714)
 * Hello [@turtle0114](https://wordpress.org/support/users/turtle0114/)
 * Can you Please send us your site health info by visiting AMP->Support
 *  Plugin Support [Milind More](https://wordpress.org/support/users/milindmore22/)
 * (@milindmore22)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/error-replacechild-on-null/#post-16487575)
 * [@turtle0114](https://wordpress.org/support/users/turtle0114/) As we didn’t receive
   a response I’ll mark this as resolved. Feel free to open a [new support topic](https://wordpress.org/support/plugin/amp/#new-post)
   if you require any further assistance.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Error (replaceChild() on null)’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

## Tags

 * [amp error](https://wordpress.org/support/topic-tag/amp-error/)

 * 5 replies
 * 2 participants
 * Last reply from: [Milind More](https://wordpress.org/support/users/milindmore22/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/error-replacechild-on-null/#post-16487575)
 * Status: resolved