# Bug when editing email code in builder

**URL:** <https://forum.mautic.org/t/bug-when-editing-email-code-in-builder/21535>\
**Category:** Mautic 4 Install/Upgrade Support\
**Created:** [November 6, 2021, 7:40am UTC](https://forum.mautic.org/t/bug-when-editing-email-code-in-builder/21535 "2021-11-06T07:40:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![symbinc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/symbinc/32/5356_2.png) [@symbinc](https://forum.mautic.org/u/symbinc)\
**Post date:** [November 6, 2021, 7:40am UTC](https://forum.mautic.org/t/bug-when-editing-email-code-in-builder/21535/1 "2021-11-06T07:40:59Z")

</div>

**Your software**  
_My PHP version is_ : 7.4.3  
_My MySQL/MariaDB version is_ (delete as applicable): 10.3.31-MariaDB-0ubuntu0.20.04.1

**Updating/Installing Errors**  
_I am_ (delete as applicable): Updating  
_Upgrading/installing via_ (delete as applicable) : Command Line

_These errors are showing in the installer_ :

_These errors are showing in the Mautic log_ : none

**Your problem**  
_My problem is_ :  
After upgrading to 4.0.1, and this may have also been happening in 4.0 – not sure – we’re seeing a weird bug where if we edit an email in the builder, the first edits are saved no problem. However, when we go back into the email to edit again, the “edit code” button is not working. If I refresh the browser after saving, I am able to get around this, but seems like there’s something else going on?

Not seeing any errors in the log.

Here’s a screencap:

https://fast.wistia.net/embed/iframe/8x007cm69g

_Steps I have tried to fix the problem_ :

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [November 12, 2021, 11:29am UTC](https://forum.mautic.org/t/bug-when-editing-email-code-in-builder/21535/2 "2021-11-12T11:29:55Z")

</div>

Hi, the edit code button works only after every second open 🙂 I think it will be fixed in 4.0.2.

---

<div class="post-metadata">

**Author:** ![stemautic88](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/stemautic88/32/690_2.png) [@stemautic88](https://forum.mautic.org/u/stemautic88)\
**Post date:** [November 17, 2021, 6:38pm UTC](https://forum.mautic.org/t/bug-when-editing-email-code-in-builder/21535/3 "2021-11-17T18:38:19Z")

</div>

Upgraded to 4.0.2 yesterday and now noticed that the code edit does only work once per session. Though, leaving the builder, doing something different and then coming back does not work as well.  
I tested it several times, to use the code edit in the builder I need to logout and login again. But it will only work once per session.  
Is there anything I could do about it?  
Thanks.

Stephan

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [November 22, 2021, 6:56am UTC](https://forum.mautic.org/t/bug-when-editing-email-code-in-builder/21535/4 "2021-11-22T06:56:24Z")

</div>

Hi,

There is a fix already which needs to be tested:

> <https://github.com/mautic/mautic/issues/10455>
>
> \### Mautic Version
> 
> 4.0.0
> 
> \### PHP version
> 
> 7.4.23
> 
> \### What browsers are you se…eing the problem on?
> 
> Firefox, Chrome
> 
> \### What happened?
> 
> This is kind of related to #10398 & #10396.
> 
> I tried out the fix described in the issues linked above, removing the set ID when changing a picture by accessing the "Edit Code" function to manually remove the ID I encountered an Issue that I was not able to open the builder after closing and saving the email.
> 
> It seems that once you manually made any edit using the "edit code" option, save the email and re-open it, you cannot access the "edit code" option anymore.
> 
> \### How can we reproduce this issue?
> 
> 1. Create a new email
> 2. Choose a template 
> 3. Open the Builder 
> 4. Open the "Edit Code" option to manually edit the MJML
> 5. Make any minor change to the MJML
> 6. Save your edit by clicking on "edit"
> 7. Close the email builder
> 8. Save and Close you Mail
> 9. Re-open the mail
> 10. Go to the builder
> 11. Try to open the "edit Code"
> 12. It won't open
> 
> \### Relevant log output
> 
> \`\`\`shell
> No Logs
> \`\`\`
> 
> 
> \### Code of Conduct
> 
> \- \[X\] I confirm that I have read and agree to follow this project's Code of Conduct

---

<div class="post-metadata">

**Author:** ![stemautic88](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/stemautic88/32/690_2.png) [@stemautic88](https://forum.mautic.org/u/stemautic88)\
**Post date:** [November 23, 2021, 1:52pm UTC](https://forum.mautic.org/t/bug-when-editing-email-code-in-builder/21535/5 "2021-11-23T13:52:22Z")

</div>

Yes, it works to reload the page while being in the builder. Then opening the builder again and the edit code button opens the modal as it should.

Thanks for letting me know 😉
