Skip to main content

CAIPE UI MongoDB Chat Quick Fix Guide

Date: 2026-02-03 Status: Troubleshooting Guide Type: Operations Documentation

Summary​

Quick fix guide for resolving authentication session issues when working with MongoDB chat persistence. Addresses expired tokens, API call failures, and share functionality problems.


Motivation​

Your authentication session has expired and the refresh token is failing. This prevents:

  • Creating new conversations in MongoDB
  • Using any MongoDB API endpoints
  • Share functionality from working

What's Different Now?​

Before (What Was Broken):

  • Expired token → API calls fail
  • Old localStorage conversations → Not in MongoDB
  • Share button → 404 errors

After (Fixed):

  • Fresh token → API calls work ✅
  • New conversations → Created in MongoDB ✅
  • Share button → Works perfectly ✅

Expected Results​

After following all steps:

✅ Fresh authentication session ✅ MongoDB running and accessible ✅ User profile created in MongoDB ✅ New conversation with UUID URL ✅ Share button works without errors ✅ Modal appears centered on screen ✅ Can copy link ✅ Can search for users

Still Need Help?​

Collect this info:

# 1. Check MongoDB
docker-compose ps mongodb

# 2. Check logs
docker-compose logs mongodb | tail -50 > mongodb.log
cat mongodb.log

# 3. Check conversation
# In browser console:
fetch('/api/chat/conversations')
.then(res => res.json())
.then(data => console.log(JSON.stringify(data, null, 2)));

# 4. Check users
fetch('/api/users/debug')
.then(res => res.json())
.then(data => console.log(JSON.stringify(data, null, 2)));

Share these outputs for further debugging.


TL;DR: Logout → Login → Clear localStorage → Create New Chat → Test Share