larksuite / larksuite/oapi-sdk-python
卡片回调接口报错
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 559
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Description
[Lark] [2025-11-12 07:36:39,306] [ERROR] handle event failed, uri: None, request_id: None, err: expected typing.Dict[str, typing.Any] but was <class 'str'> at field: value
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/lark_oapi/event/dispatcher_handler.py", line 98, in do
data = JSON.unmarshal(plaintext, processor.type())
File "/usr/local/lib/python3.13/site-packages/lark_oapi/core/json.py", line 22, in unmarshal
return clazz(dict_obj)
File "/usr/local/lib/python3.13/site-packages/lark_oapi/event/callback/model/p2_card_action_trigger.py", line 90, in init
super().init(d)
~~~~~~~~~~~~~~~~^^^
File "/usr/local/lib/python3.13/site-packages/lark_oapi/event/context.py", line 33, in init
init(self, d, self._types)
~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/lark_oapi/core/construct.py", line 13, in init
setattr(obj, k, parse(t, v, k))
~~~~~^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/lark_oapi/core/construct.py", line 48, in parse
return t(v)
File "/usr/local/lib/python3.13/site-packages/lark_oapi/event/callback/model/p2_card_action_trigger.py", line 81, in init
init(self, d, self._types)
~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/lark_oapi/core/construct.py", line 13, in init
setattr(obj, k, parse(t, v, k))
~~~~~^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/lark_oapi/core/construct.py", line 48, in parse
return t(v)
File "/usr/local/lib/python3.13/site-packages/lark_oapi/event/callback/model/p2_card_action_trigger.py", line 61, in init
init(self, d, self._types)
~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/lark_oapi/core/construct.py", line 13, in init
setattr(obj, k, parse(t, v, k))
~~~~~^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/lark_oapi/core/construct.py", line 31, in parse
raise UnmarshalException(t, type(v), field)
lark_oapi.core.exception.UnmarshalException: expected typing.Dict[str, typing.Any] but was <class 'str'> at field: value
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the traceback path in lark_oapi/event/dispatcher_handler.py and follow JSON.unmarshal in lark_oapi/core/json.py into lark_oapi/core/construct.py. Inspect the card callback model at lark_oapi/event/callback/model/p2_card_action_trigger.py and identify the expected shape of the value field. Done should be defined by the reported callback payload unmarshalling without this exception, with a regression check for that payload.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100