Skip to content

fix(gateway/line): correct message_type mapping and source factory method - #23867

Closed
irandoku wants to merge 0 commit into
NousResearch:mainfrom
irandoku:main
Closed

fix(gateway/line): correct message_type mapping and source factory method#23867
irandoku wants to merge 0 commit into
NousResearch:mainfrom
irandoku:main

Conversation

@irandoku

Copy link
Copy Markdown

Summary

Fixes two AttributeError crashes in the LINE adapter that prevent inbound messages from ever reaching the agent.

Bug 1: Missing build_source method (fixes #23728)

self.create_source() is not a method on BasePlatformAdapter. The correct factory method is self.build_source(), used by all other platform adapters (IRC, Teams, etc.).

Before this fix, every inbound LINE message crashed with:

AttributeError: 'LineAdapter' object has no attribute 'create_source'

Bug 2: Non-existent MessageType.IMAGE member

gateway/platforms/base.py defines MessageType with PHOTO (not IMAGE) as the member for image/photo messages. The fallback expression:

MessageType.TEXT if msg_type == "text" else MessageType.IMAGE

throws AttributeError: IMAGE on every non-text inbound message. It also incorrectly classifies audio, video, file, sticker, and location messages as images.

Fix: Replace with an explicit mapping using the correct enum members:

  • imageMessageType.PHOTO
  • audioMessageType.AUDIO
  • videoMessageType.VIDEO
  • fileMessageType.DOCUMENT
  • stickerMessageType.STICKER
  • locationMessageType.LOCATION

Testing

  • Verified locally: text, image, sticker, and location messages now dispatch correctly through LINE webhooks.
  • python -m py_compile plugins/platforms/line/adapter.py passes.

Related

@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels May 11, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #23305 — 5th PR for the LINE adapter create_source→build_source fix (#23728). This PR additionally fixes MessageType.IMAGE→PHOTO mapping, but the primary fix duplicates #23305, #23569, #23730, #23782.

wuwushi4 pushed a commit to wuwushi4/hermes-agent that referenced this pull request May 20, 2026
Two AttributeError crashes prevented inbound LINE messages from
reaching the agent:

- `self.create_source` does not exist on `BasePlatformAdapter`; the
  factory is `self.build_source` (used by IRC, Teams, etc.).
- `MessageType.IMAGE` is not a member of the enum — `PHOTO` is.  The
  ternary fallback also mis-classified audio, video, file, sticker,
  and location messages as images.

Mirrors PR NousResearch#23867.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@irandoku irandoku closed this Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: LINE adapter crashes with AttributeError: 'LineAdapter' object has no attribute 'create_source'

2 participants