claude-code - 💡(How to fix) Fix [BUG] Long session produces broken outputs that repeat itself partially for half a dozen times and then complete. [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54067Fetched 2026-04-28 06:40:07
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
0
Timeline (top)
labeled ×5commented ×1cross-referenced ×1renamed ×1

Error Message

Error Messages/Logs

❌ Error: MongooseError: The uri parameter to openUri() must be a string, got

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Claude also demonstrated the similar weird pattern in which it breaks itself
midway displaying a long result and repeating the already-displayed parts over
and over again until it repeats a dozen times and then finish the rest.

What Should Happen?

Claude should just display all the outputs and stop at the next prompt.

Error Messages/Logs

Steps to Reproduce

Very hard to reproduce. It usually happens after a longer session involves debugging such as these messages:

Connecting to MongoDB...

❌ Error: MongooseError: The uri parameter to openUri() must be a string, got "undefined". Make sure the first parameter to mongoose.connect() or
mongoose.createConnection() is a string.
at Connection.openUri
(/usr/src/app/node_modules/mongoose/lib/connection.js:694:11)
at /usr/src/app/node_modules/mongoose/lib/index.js:351:10
at /usr/src/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:32:5
at new Promise (<anonymous>)
at promiseOrCallback
(/usr/src/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:10)
at Mongoose._promiseOrCallback
(/usr/src/app/node_modules/mongoose/lib/index.js:1149:10)
at Mongoose.connect (/usr/src/app/node_modules/mongoose/lib/index.js:350:20)
at analyzeSessions (/usr/src/app/scripts/analyze-sessions.js:24:18)
at Object.<anonymous> (/usr/src/app/scripts/analyze-sessions.js:149:1)
at Module._compile (node:internal/modules/cjs/loader:1521:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
at Module.load (node:internal/modules/cjs/loader:1266:32)
at Module._load (node:internal/modules/cjs/loader:1091:12)
at Function.executeUserEntryPoint [as runMain]
(node:internal/modules/run_main:164:12)
at node:internal/main/run_main_module:28:49

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.119 (Claude Code)

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

No response

extent analysis

TL;DR

The issue might be related to the MongooseError caused by an undefined uri parameter, which could be contributing to the repeated output pattern in Claude.

Guidance

  • Investigate the analyze-sessions.js script, specifically line 24, where the Mongoose connection is established, to ensure the uri parameter is correctly defined and passed to mongoose.connect().
  • Verify that the MongoDB connection string is properly configured and available in the environment where the script is running.
  • Check for any potential asynchronous issues or promise handling problems in the analyze-sessions.js script that could lead to the repeated output.
  • Consider adding error handling or logging to better understand the sequence of events leading to the repeated output.

Notes

The provided error message suggests a Mongoose connection issue, but the repeated output pattern described in the issue might be a separate problem. Further investigation into the script's logic and error handling is necessary to determine the root cause.

Recommendation

Apply workaround: Temporarily modify the analyze-sessions.js script to include additional logging or error handling to better understand the issue, as the problem is difficult to reproduce and the root cause is not immediately clear.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING