com.atlassian.workcontext.exception.WorkContextSeveredException: No WorkContext set

We are encountering a new type of exception in the Confluence REST API.

What we are doing is that we copying a page through the REST API and then update the page immediately to update relative page links that are using absolute URLs (as documented here). When updating the page for the first time, we receive an OptimisticLockException, so we retry the operation (as documented here).

Now we are seeing a new type of exception. The exact error message is com.atlassian.util.concurrent.LazyReference$InitializationException: com.atlassian.workcontext.exception.WorkContextSeveredException: No WorkContext set. The error occurs while doing a PUT /wiki/rest/api/content/${contentId}, updating the content body, resulting in a 500 Internal Server Error.

We are seeing this only on one specific Confluence Cloud instance. I have no idea how/whether it is reproducible on other instances at all. The customer for whom this happens is severely impacted in their ability to use our app because of this.

Has anyone experienced such an error before? What could be the cause? What can we do to avoid it, might retrying the operation work?

2 Likes

Hi @candid ,

I don’t think I’ll be able to help with this one so I’ll reach out to the Confluence Cloud team to request their help.

Regards,
Dugald

Hi @candid , what value are we using for destination in the copy single page API?
We’d need more logs to see why 500 internal server error was showing up. Do you happen to know which tenant/ tenant ID this is? We’d have to look at the customer’s logs in splunk to understand the flow better. I also request a rough timeline when this issue occurred to query Splunk.

Also might be worth checking 1. if the content ID used in PUT request is valid and the changes were saved 2. Probably retrying the operation isn’t a bad idea since the references you pointed at suggest making immediate changes to a page’s children might still have pending backend changes ongoing and hence fail the requested task.

Thanks

Hi @JatinChopra, this error is now appearing several times in our logs, the latest one happened on tenant c20a8795-6ea8-3c6f-bb9b-ea6ef5dcab7c at 2021-05-24T18:02:10Z.

For the copy operation we are using a {"type":"parent_page","value":"[page ID]"} destination.

Hi @candid , Can you please do a GET /wiki/rest/api/content/${contentId} before doing a PUT /wiki/rest/api/content/${contentId} for updating the Storage format ?
It’s likely that the content hasn’t synced yet after being moved under new parent_page.

@JatinChopra To clarify, does this mean that doing the GET will make sure that the content is synced, whereas the PUT does not?

Hi @candid , I talked to a team and they want you to try the PUT request again. Please let us know if it works now.

Hi @candid , waiting to hear back from you if the issue is now resolved.
cc: @dmorrow

Thanks

Hey @JatinChopra, these kinds of errors are hard to reproduce as they occur only on certain Confluence instances at certain times with certain content objects. All I can tell for now is that the customer reported shortly after that the error didn’t occur anymore. The error message has not appeared in our logs anymore in the last 14 days.

I will continue to monitor our log files and report it if I see the error again.

Thanks for the quick reaction.