String flag values containing colons (:) are silently parsed as YAML key-value mappings instead of being treated as plain strings. This causes 400 errors from the API because fields like subject and text are sent as objects instead of strings.
With --debug, you can see the request body:
"S4: test" was parsed as YAML mapping {S4: test} → sent as {"S4":"test"}.
In internal/requestflag/requestflag.go, the parseCLIArg function falls through to yaml.Unmarshal for any flag typed as any (rather than explicitly string). Since "S4: test" is valid YAML for a mapping, it gets deserialized as map[string]any{"S4": "test"} instead of remaining a plain string.
The allowAsLiteralString fallback only triggers when YAML parsing fails, so valid-but-unintended YAML like colon-separated strings silently become objects.
This is likely a Stainless CLI framework issue (stainless-api/stainless-api-cli) rather than agentmail-specific, since the requestflag code is generated.
- CLI version: 0.7.4
- OS: macOS (arm64)
- Go: 1.25.8
Use the REST API directly via curl instead of the CLI for any values containing colons.
String flag values containing colons (
:) are silently parsed as YAML key-value mappings instead of being treated as plain strings. This causes 400 errors from the API because fields likesubjectandtextare sent as objects instead of strings.With
--debug, you can see the request body:{"subject":{"S4":"test"},"text":"hello","to":"[email protected]"}"S4: test"was parsed as YAML mapping{S4: test}→ sent as{"S4":"test"}.In
internal/requestflag/requestflag.go, theparseCLIArgfunction falls through toyaml.Unmarshalfor any flag typed asany(rather than explicitlystring). Since"S4: test"is valid YAML for a mapping, it gets deserialized asmap[string]any{"S4": "test"}instead of remaining a plain string.The
allowAsLiteralStringfallback only triggers when YAML parsing fails, so valid-but-unintended YAML like colon-separated strings silently become objects.This is likely a Stainless CLI framework issue (
stainless-api/stainless-api-cli) rather than agentmail-specific, since therequestflagcode is generated.Use the REST API directly via
curlinstead of the CLI for any values containing colons.