Repository navigation
fix(claude): accept initialize capabilities sent as a list of names - #25
Merged
Merged
Conversation
Claude Code 2.1.287 answers the initialize control request with `"capabilities": ["ui_surface_v1"]`, a list of names, where this SDK required an object. asJsonMap threw "initialize.capabilities must be a JSON object", which failed the whole initialize response, so every session against that CLI died before its first turn. A listed name now reads as `name: true`; an object is kept as before; any other shape is left to `raw` instead of failing. The field is an open-set advertisement, so an unknown shape must not end the session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PxGo16ehbCKTyimWWkrjEt
sbis04
approved these changes
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Claude Code 2.1.287 answers the
initializecontrol request with"capabilities": ["ui_surface_v1"], a list of names.ClaudeInitializationResult.fromJsonrequires an object here, soasJsonMapthrowsFormatException: initialize.capabilities must be a JSON object. That fails the whole initialize response, and every Claude session against that CLI dies before its first turn.The FlutterFlow desktop agent panel always runs Claude over ACP through
dart_acp_claude. On 2.1.287 every Claude chat fails on the first message with:Change (
packages/claude_agent_sdk/lib/src/initialization.dart){name: true}.ui_surface_v1becomes{'ui_surface_v1': true}.raw.capabilitiesis an open-set advertisement, so a shape this SDK doesn't know shouldn't end the session.JsonMap capabilities) is unchanged.The
initsystem message already decodescapabilitiesas a string list (message_codec.dart), so this matches what the CLI sends there too.Verified
{"type":"control_request","request_id":"r1","request":{"subtype":"initialize","hooks":null}}toclaude -p --input-format stream-json --output-format stream-json(2.1.287), and the response hascapabilities: ["ui_surface_v1"].test/models_test.dartcover a list, an object, and a missing or unknown shape. Without the fix, the list test fails with the exact error above; with it, all 104claude_agent_sdktests pass.dart analyze --fatal-infos packages/claude_agent_sdkanddart formatare clean.Follow-up in FlutterFlow: bump the
claude_agent_sdkoverride influtterflow/pubspec.yaml(currently45023fd) to the merged commit.claude_agent_sdkis identical between45023fdandmain, so the bump carries only this fix.🤖 Generated with Claude Code
https://claude.ai/code/session_01PxGo16ehbCKTyimWWkrjEt