Skip to content

Windows: --params JSON parsing fails for im messages read_users (and other non-empty params calls) #64

@GannonSun

Description

@GannonSun

Summary

On Windows, lark-cli appears to support im messages read_users, but any call that passes a non-empty JSON object to --params fails in CLI parsing.

The Feishu OpenAPI itself works correctly. The same request succeeds in the official API debugger.

Environment

  • OS: Windows
  • Shell: PowerShell
  • CLI version: lark-cli 1.0.0

What works

  • lark-cli im messages read_users --help
  • lark-cli schema im.messages.read_users
  • Feishu OpenAPI debugger successfully calls:
    • GET /open-apis/im/v1/messages/{message_id}/read_users
    • with user_id_type=open_id

What fails

This command is expected to work, but fails with JSON parsing error:

lark-cli im messages read_users --as bot --params '{"message_id":"om_x100b53a771492ca8b4ca3ca7535d2d0","user_id_type":"open_id"}' --format json

Actual result:

{
  "ok": false,
  "identity": "bot",
  "error": {
    "type": "validation",
    "message": "--params invalid JSON format"
  }
}

I also observed similar behavior on Windows for other commands when --params is a non-empty JSON object.

For example, even a simple dry-run can fail:

lark-cli api GET /open-apis/calendar/v4/calendars --as user --dry-run --params '{"foo":"bar"}'

Actual result:

{
  "ok": false,
  "identity": "user",
  "error": {
    "type": "validation",
    "message": "--params invalid format, expected JSON object"
  }
}

Additional notes

  • Empty params like --params '{}' may pass in some cases.
  • Non-empty JSON consistently fails in my Windows environment.
  • I also tried PowerShell stop-parsing (--%) and different quoting styles, but the result was the same.

Expected behavior

--params should accept valid JSON objects on Windows the same way it does conceptually on other platforms, especially for generated commands like:

lark-cli im messages read_users --as bot --params '{"message_id":"...","user_id_type":"open_id"}'

Why I believe this is a CLI issue

  • The API itself is valid and returns success in the official Feishu API debugger.
  • The CLI exposes the command in help and schema.
  • The failure happens before the API request is successfully formed, at parameter parsing/validation stage.

If there is a Windows-specific correct way to pass non-empty JSON into --params, please document it. Otherwise this looks like a CLI parsing bug on Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdomain/imPR touches the im domain

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions