Bug: Switching agent provider (Antigravity → Claude Code) fails: canonical...
Summary
Switching agent provider (Antigravity → Claude Code) fails: canonicalJson cannot serialize Date
Environment
- Maestro version: 1.1.0-RC
- Operating system: macOS (Darwin Kernel Version 25.4.0: Thu Mar 19 19:26:07 PDT 2026; root:xnu-12377.101.15~1/RELEASE_ARM64_T6031, 25.4.0)
- Install source: Packaged build (release build or locally packaged)
- Agent/provider involved: Not provided
- SSH remote execution: Not provided
Steps to Reproduce
- Run an Antigravity agent ("Regente") with Auto Run until its token quota is exhausted.
- Try to switch that agent's provider to Claude Code.
- The error "canonicalJson cannot serialize an instance of Date" appears and the switch stops before it starts.
Expected Behavior
After the Antigravity quota runs out, switching the agent's provider to Claude Code should migrate the agent and let it keep working.
Actual Behavior
The switch fails right away with the error "canonicalJson cannot serialize an instance of Date". No migration happens: the agent "Regente" still shows provider antigravity, with Auto Run active.
Additional Context
Maestro 1.1.0-RC packaged build, macOS 25.4.0 arm64. maestro-cli list agents shows "Regente" as provider antigravity [Auto Run], so the provider did not change. The string "canonicalJson cannot serialize" is present in /Applications/Maestro.app/Contents/Resources/app.asar. canonicalJson is a strict serializer that rejects Date objects; it is otherwise used by the Lite remote-access/pairing code. Likely cause: the provider-switch/migration payload contains a raw Date (for example a session timestamp or the token-exhaustion pause/retry time) passed without toISOString(). Other Antigravity agents are currently in Agent Resilience token-exhaustion retry (attempt 38), which matches the quota-exhausted state the switch starts from. File logging is off, so no log line is available. The app heap is high (1.8 GB) with 189 agents, which is probably unrelated.
Submitted before the interview finished (understanding 65%). The reporter's own words:
canonicalJson cannot serialize an instance of Date
Eu estava usando o Regente com Anti-Gravity, aí minha cota acabou, fui trocar para o claude Code e não consegui, ele deu esse bug. Ele não conseguiu nem começar a troca, parou ai.
Live Diagnosis
Captured by the app when the issue was filed. 193 agent(s), 12 notable:
- Agent 1 (claude-code), state=busy
- Agent 2 (claude-code, SSH remote), state=idle, 1 queued message(s)
- Agent Resilience retry: availability, scheduled, attempt 27, next in 16m
- Agent 3 (claude-code, SSH remote), state=busy
- Agent 4 (claude-code), state=busy
- Agent 5 (claude-code), state=busy, 3 queued message(s)
- Agent 6 (antigravity), state=idle, 1 queued message(s)
- Agent Resilience retry: token-exhaustion, scheduled, attempt 46, next in 6m
- Agent 7 (antigravity), state=idle, 1 queued message(s)
- Agent Resilience retry: token-exhaustion, scheduled, attempt 46, next in 7m
- Agent 8 (claude-code), state=error
- Error: error=unknown, recoverable, agent paused, 11h 15m ago
- Agent 9 (codex), state=busy
- Agent 10 (codex), state=busy, 2 queued message(s)
- Agent 11 (claude-code), state=busy, 1 queued message(s)
- Agent 12 (codex), state=busy
- Auto-resume on limit: on, checks every 2h, gives up after 7d
Screenshots / Recordings

Thanks for the detailed report, @felipeggv. The exact error string made this quick to trace.
We think we have a fix in #2019. Before a provider switch, Maestro reads the frontmatter of the skills and subagents in the agent's project (.claude/skills, .agents/skills, .codex/skills, .claude/agents, .codex/agents). If one of them has an unquoted date, for example updated: 2025-11-03, the YAML parser turns it into a Date object. The step that fingerprints the switch plan cannot serialize a Date, so the switch fails before it starts. Antigravity and the exhausted quota are probably not involved.
Until the fix ships, a workaround: in the Regente project, find the skill or agent file whose frontmatter has a date, and put quotes around the date (updated: "2025-11-03"). Then try the switch again.
Could you check two things? Does Regente's project have a skill or agent file with a date in its frontmatter? And does the PR look right to you?