Answers.Body: <p>Because mosaico uses the new-ish afform form tools (i.e. an integration of AngularJS), it means that a lot of the communication from the form to the server is happening via ajax. When that back-channel communication fails, that's when you get that message.</p>
  <p>Possible reasons for the failure include:</p>
  <ol>
  <li>The same form open in a different window (leading to invalid state data being sent to the server).</li>
  <li>A network problem between your window and the server.</li>
  <li>A server error due to a bug.</li>
  <li>A server non-response due to a delay.</li>
  </ol>
  <p>Your solution will depend on diagnosing which of these is going on, using:</p>
  <ol>
  <li>Your browser developer tools network tab and console.</li>
  <li>Your civicrm, CMS and server logs.</li>
  </ol>
  <p>A lot of the time, you may get that message without it meaning anything terrible and it can be ignored, but usually you want to try an explicit save at that point and then check the civicrm server logs for errors.</p>
  <p>For example, I have a client out in the country using a satellite-based ISP, and she regularly has this issue - not much to do except wait for the cloud to stop blocking the satellite ...</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-16T18:35:52.140Z
Answers.Text: Thanks Alan. I definitely see what you're talking about sometimes, but I think there's also something more significant happening, when no one can save any mailings. Recently, we had a case where multiple people in multiple different locations were unable to save their mailings—until I cleared the cache (in CiviCRM) and then it seemed to work for everyone. I'm guessing that's the kind of thing that needs further investigation, so I'll try to dig in deeper next time it happens, unless you have any suggestions for that now.
Answers.UserDisplayName: Lars SG
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-16T22:41:09.090Z
Answers.Text: So that rules out 2. and maybe 1. Sounds like in your case it could be a database lock or race condition issue of some kind. If you send me the timing (exactly when you cleared the cache, and approx how long before that it started hapenning), I can look at your logs.
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-17T03:19:47.550Z
Answers.Text: Thanks, I'll let you know next time it happens. The last time this happened to everyone was more than a month ago.
Answers.UserDisplayName: Lars SG
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-11T14:06:26.880Z
Answers.LastActivityDate: 2020-12-11T14:06:26.880Z
Answers.UserDisplayName: Alan Dixon
Answers.Body: <p>In my case the reason was an emoticon in one of the content blocks – after removing it the error disappeared. The well known reason is database encoding and described eslewhere, e.g. <a href="https://lab.civicrm.org/dev/core/-/wikis/utf8mb4" rel="nofollow noreferrer">here</a> or <a href="https://lab.civicrm.org/dev/core/-/issues/339" rel="nofollow noreferrer">here</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-01T11:18:31.323Z
Answers.LastActivityDate: 2021-09-01T11:18:31.323Z
Answers.UserDisplayName: Andreas
Body: <p>Occasionally, we get a warning &quot;Mailing has not been saved, Content maybe out of date, please refresh the page and try again&quot; when trying to save a Mosaico mailing.&quot; The mailing does not save and any changes are lost. When this happens, it seems to happen for everyone and every mailing. This also prevents a test email from being sent, presumably because the mailing can't be saved.</p>
  <p>Cleanup caches seems to fix this problem, but not before whatever changes the user has inputted are lost and hair is torn out, tears are shed, etc.</p>
  <p>Nothing is logged when this happens. I have been seeing this for quite a while, at least since 4.X. Here is a <a href="https://civicrm.stackexchange.com/questions/21915/error-message-in-civimail-mailing-has-not-been-saved-content-maybe-out-of-dat">past question</a> about what sounds like a similar issue.</p>
  <p>Is there anything to be done to fix avoid this in the future? Anyone have any idea what the problem may be?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-13T02:46:59.500Z
Comments.Text: This seems to arise when you open a mailing on 2 different windows and save second before saving the first one. or Eg Contact A opens mailing M1, the same mailing is opened by Contact B on a different computer/window. Now when contact A tries to save the mailing, as it is already opened by contact B, you get the above error.
Comments.UserDisplayName: jitendra - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-13T04:53:42.443Z
Comments.Text: I've seen that happen sometimes. But it also is definitely happening when only open in one window.
Comments.UserDisplayName: Lars SG
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-20T23:45:29.743Z
Comments.Text: I also occasionally see this warning:
  We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site administrator for assistance. Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org [..]. Error type: Could not find a valid session key.
Comments.UserDisplayName: Lars SG
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-20T23:46:31.943Z
Comments.Text: Just in case the two issues may be related
Comments.UserDisplayName: Lars SG
Tags: <civimail><mosaico>
Title: Mailing not saved, must cleanup caches to be able to save again
ThreadText: # Mailing not saved, must cleanup caches to be able to save again
  
  (Asked by: username_0 on 2020-11-13)
  
  Occasionally, we get a warning "Mailing has not been saved, Content maybe out of date, please refresh the page and try again" when trying to save a Mosaico mailing." The mailing does not save and any changes are lost. When this happens, it seems to happen for everyone and every mailing. This also prevents a test email from being sent, presumably because the mailing can't be saved.
  
  Cleanup caches seems to fix this problem, but not before whatever changes the user has inputted are lost and hair is torn out, tears are shed, etc.
  
  Nothing is logged when this happens. I have been seeing this for quite a while, at least since 4.X. Here is a [past question](https://civicrm.stackexchange.com/questions/21915/error-message-in-civimail-mailing-has-not-been-saved-content-maybe-out-of-dat) about what sounds like a similar issue.
  
  Is there anything to be done to fix avoid this in the future? Anyone have any idea what the problem may be?
  
  **Tags:** civimail, mosaico
  
  > **Comments:**
  > **username_1**: This seems to arise when you open a mailing on 2 different windows and save second before saving the first one. or Eg Contact A opens mailing M1, the same mailing is opened by Contact B on a different computer/window. Now when contact A tries to save the mailing, as it is already opened by contact B, you get the above error.  
  > **username_0**: I've seen that happen sometimes. But it also is definitely happening when only open in one window.  
  > **username_0**: I also occasionally see this warning: We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site administrator for assistance. Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org [..]. Error type: Could not find a valid session key.  
  > **username_0**: Just in case the two issues may be related  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2020-12-11. Score: 1
  
  Because mosaico uses the new-ish afform form tools (i.e. an integration of AngularJS), it means that a lot of the communication from the form to the server is happening via ajax. When that back-channel communication fails, that's when you get that message.
  
  Possible reasons for the failure include:
  
  1. The same form open in a different window (leading to invalid state data being sent to the server).
  2. A network problem between your window and the server.
  3. A server error due to a bug.
  4. A server non-response due to a delay.
  
  Your solution will depend on diagnosing which of these is going on, using:
  
  1. Your browser developer tools network tab and console.
  2. Your civicrm, CMS and server logs.
  
  A lot of the time, you may get that message without it meaning anything terrible and it can be ignored, but usually you want to try an explicit save at that point and then check the civicrm server logs for errors.
  
  For example, I have a client out in the country using a satellite-based ISP, and she regularly has this issue - not much to do except wait for the cloud to stop blocking the satellite ...
  
  > **Comments:**
  > **username_0**: Thanks Alan. I definitely see what you're talking about sometimes, but I think there's also something more significant happening, when no one can save any mailings. Recently, we had a case where multiple people in multiple different locations were unable to save their mailings—until I cleared the cache (in CiviCRM) and then it seemed to work for everyone. I'm guessing that's the kind of thing that needs further investigation, so I'll try to dig in deeper next time it happens, unless you have any suggestions for that now.  
  > **username_2**: So that rules out 2. and maybe 1. Sounds like in your case it could be a database lock or race condition issue of some kind. If you send me the timing (exactly when you cleared the cache, and approx how long before that it started hapenning), I can look at your logs.  
  > **username_0**: Thanks, I'll let you know next time it happens. The last time this happened to everyone was more than a month ago.  
  
  ---
  
  ### Answer by username_3 on 2021-09-01. Score: 0
  
  In my case the reason was an emoticon in one of the content blocks – after removing it the error disappeared. The well known reason is database encoding and described eslewhere, e.g. [here](https://lab.civicrm.org/dev/core/-/wikis/utf8mb4) or [here](https://lab.civicrm.org/dev/core/-/issues/339).
  
  
  ---
  
  