Skip to content

fix(cli): fix critical crashes, improve error messages, UX and validation in Node.js and Python SDKs#4636

Merged
whysosaket merged 2 commits intomem0ai:mainfrom
whysosaket:feature/fix-cli-bugs
Mar 31, 2026
Merged

fix(cli): fix critical crashes, improve error messages, UX and validation in Node.js and Python SDKs#4636
whysosaket merged 2 commits intomem0ai:mainfrom
whysosaket:feature/fix-cli-bugs

Conversation

@whysosaket
Copy link
Copy Markdown
Member

Summary

  • Node.js CLI: Fixes a critical MODULE_NOT_FOUND crash affecting status, import, and all commands when installed globally; improves API error messages, adds full UUID display in tables, score column in search, short config key aliases, client-side input validation, and several UX fixes
  • Python CLI: Fixes double error printing on all commands; adds full UUID in tables, score column in search, short config key aliases, client-side validation, and UX parity with Node.js

Node.js Changes (cli/node)

Critical

  • Fix status/import/all-command crash (Cannot find module '../../package.json') — replaced runtime createRequire + relative path loading with build-time __CLI_VERSION__ injection via new tsup.config.ts

High

  • API errors now show full response detail (body.detail ?? body.message ?? JSON.stringify(body)) instead of bare "Bad Request"

Medium

  • Table now shows full UUIDs (was truncated to 8 chars, making mem0 get <id> fail)
  • Search table now includes Score column
  • config get api_key now works — added short-form key aliases (api_key, user_id, etc.)
  • printInfo / printScope moved to stderr (was stdout, could contaminate JSON piping)
  • Client-side validation for --expires (format + future date), --page-size (≥1), --page (≥1), --top-k (≥1), --threshold (0–1), empty content

Low

  • Multi-category memories show cat (+N) in table instead of first category only
  • -o quiet for list/search now silently exits
  • mem0 version registered as a proper subcommand
  • list -o json now returns a pagination envelope (status, command, count, scope, data) instead of a bare array

Python Changes (cli/python)

High

  • Fix double error printing — cmd_add was calling print_error() explicitly AND setting ts.error_msg, causing timed_status to print a second time with timing suffix

Medium

  • Table now shows full UUIDs (same fix as Node)
  • Search table now includes Score column
  • config get api_key short-form aliases added
  • delete --all --project --dry-run now includes a note about count
  • Client-side validation for --expires, --page-size, --page, --top-k, --threshold, empty search query

Low

  • Multi-category cat (+N) display
  • -o quiet for list/search exits silently
  • mem0 version registered as a subcommand
  • list -o json returns pagination envelope

Not Fixed (API-side)

  • --graph 400 (plan-gated feature)
  • delete --entity 405 for agent/app/run (API endpoint limitation)
  • list count difference vs dashboard (v2 API filtering difference)
  • --categories overridden by API auto-categorization
  • --filter undocumented format

Test plan

  • Node build passes (npm run build)
  • Python tests pass (pytest — 118/118)
  • mem0 status no longer crashes
  • mem0 import no longer crashes
  • Full UUIDs in table, mem0 get <uuid> works
  • Score column visible in search table output
  • config get api_key returns value
  • All client-side validation errors trigger before API call
  • JSON output is clean (no stdout contamination)
  • mem0 version works as subcommand
  • Error messages print exactly once in Python

🤖 Generated with Claude Code

@whysosaket whysosaket merged commit 9bebcf4 into mem0ai:main Mar 31, 2026
1 of 2 checks passed
@whysosaket whysosaket deleted the feature/fix-cli-bugs branch March 31, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants