Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Prune not working in powershell 7.5.2 win11

I_ Pick L0X
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 28, 2025

It breaks my session every time I use it and I have to delete the session from the sessions folder. The log has a warning, I assume there is a permissions or file lock issue happening


2025-06-28 22:25:38.106 | WARNING | - Failed to update context tokens in the final message.

2025-06-28 22:25:38.106 | INFO | - Conversation pruned - context tokens will be updated in the next request.
Because the session_context.json file is now empty: 2025-06-28 22:25:40.288 | ERROR | - An unexpected error occurred, exiting.
2025-06-28 22:25:42.214 | ERROR | - An unexpected error occurred, exiting. 
unexpected error spam infinite loop

1 comment

Comment

Log in or Sign up to comment
ashu patel
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 29, 2025

Hi there,

Thanks for sharing the logs and details—this definitely looks like a session management issue related to how session_context.json is being handled during the prune operation in PowerShell 7.5.2 on Windows 11.

From the logs and your description, it seems the prune command is either:

encountering file lock or permission issues, or

attempting to update a context file that’s already in a corrupted or empty state, leading to an infinite error loop.

Here are a few steps that might help resolve or narrow down the issue:

Check Permissions
Make sure PowerShell is being run with elevated permissions (as Administrator). If the session folder or session_context.json is write-protected or locked by another process, this could cause the update failure.

Verify File Locking
Use a tool like Sysinternals' Process Explorer to check if another process is locking session_context.json at the time of pruning.

Try a Clean Start
Manually delete the entire session folder (as you're already doing), then reinitialize a fresh session. If you're using a CLI tool that stores context in that file, you might also check for updates or issues specific to its version.

Avoid Concurrent Sessions
If you have multiple terminals open using the same session context, prune operations could clash and corrupt the file. Try using the tool in a single session to avoid race conditions.

Report the Bug
If you're using a third-party CLI tool that uses this pruning mechanism (such as a local AI model CLI or context handler), and it's open-source, it’s worth submitting a bug report along with these logs. There might already be a patch or a fix under review.

Let me know which tool or framework you're using in combination with PowerShell—happy to dig deeper into known issues or provide a tailored workaround.

Best,
Ashu Patel
Atlassian Community Contributor

Like Jovana Dunisijevic likes this
TAGS
AUG Leaders

Atlassian Community Events