Skip to content

[Bug] mavis memory daily-update returns 40002 due to JS object key mismatch (agent_name vs agentName) #66

@seasonmsg

Description

@seasonmsg

[MiniMax Code Bug Report] mavis memory daily-update <agentId> returns 40002 due to JS object key mismatch

Submit to: MiniMax-AI/minimax-code Issues → New Issue → Bug template
Reporter: mavis (Mavis owner-side bug report, 2026-06-15)
Severity: Medium — CLI workflow broken, no daemon-side workaround
MiniMax Code version tested: latest as of 2026-06-10 (cli.js lastWriteTime 2026-06-10 21:58)
Platform: Windows 11 (also reproducible on macOS / Linux — bug is in cross-platform esbuild bundle)
Upload ID: [PENDING — to be generated by reporter from Settings → General → Upload logs before submission]


Summary

mavis memory daily-update <agentId> consistently fails with HTTP 40002 "Missing or invalid 'agentName' field" because the CLI sends { agent_name: agentId } (snake_case) but the daemon API expects agentName (camelCase). The bug is a JS object key mismatch in cli.js (esbuild bundle), not a JSON serialization issue.

Steps to Reproduce

# Pre-conditions: MiniMax Code daemon running, agent "mavis" registered
$ mavis memory daily-update mavis
# Expected: success message, daily digest triggered
# Actual:
# Error: HTTP 40002 Missing or invalid 'agentName' field

Root Cause

File: resources/resources/daemon/cli.js (esbuild bundle, 2,057,772 bytes as of 2026-06-10)

Offset 1783081 contains:

await getClient().post("/api/memory/daily/update", { agent_name: agentId });

The HTTP body sent by getClient().post() is { "agent_name": "<id>" }, but the daemon endpoint POST /mavis/api/memory/daily/update expects { "agentName": "<id>" } (camelCase per daemon API schema).

Proposed Fix

Single-line replacement in cli.js (pre-esbuild source):

- await getClient().post("/api/memory/daily/update", { agent_name: agentId });
+ await getClient().post("/api/memory/daily/update", { agentName: agentId });

Verification (Owner-Side Dry-Run)

  • Copy of original cli.js: SHA256 C837E91B91111C33292374130FCA347190939FAC5F551BA5ED2EA7866A610F5A
  • Patched cli.js (single line): SHA256 D24731F8EA2C402ACEFD912B42505BF04C147F13CEE2E444F25A9876B4006DDE
  • Hash differs: confirmed single-line edit is technically feasible
  • Owner-side: NOT applied (would be overwritten on next MiniMax update, band-aid fix)

Why This Should Be Fixed in Official Release

  • Affects any user running mavis memory daily-update (documented CLI workflow)
  • Owner-side patch is impractical: cli.js lives in Program Files\MiniMax Code\ and gets overwritten on update
  • Trivial one-line fix in the source cli.js (pre-esbuild)
  • Blocks daily memory digest automation for the entire Mavis community

Workaround (Until Fixed)

Owner-side: skip mavis memory daily-update CLI, edit MEMORY.md directly with daily digest content.

Related

  • Internal docs: E:\Minimaxi\knowledge\raw\2026-06-15-cli-js-daily-update-patch-dry-run\
  • Verification assets: cli.js.bak / cli.js.patched / cli.js.diff / test-cli-patch.ps1
  • Bug pattern can be located by grep -n 'agent_name: agentId' cli.js after a source build (offset varies across versions in the esbuild bundle).

For MiniMax Maintainers

  • The fix is a single character: change agent_name to agentName (snake_case to camelCase) in the object literal.
  • The daemon-side API contract uses camelCase agentName consistently — the CLI is the outlier.
  • Note for future: please consider lint or schema check that catches object-key naming inconsistencies between client and server.

Tags

bug cli mavis memory daily-update 40002 schema-mismatch camelCase-vs-snake_case

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions