Skip to content

smee client crashes when quoting bot comments (because of emojis?) #320

Closed

Description

@bedroge

For my RISC-V bot I noticed that the smee client crashed a couple of times with:

node:_http_outgoing:628
    throw new ERR_INVALID_CHAR('header content', name);
    ^

TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["rawdata"]
    at ClientRequest.setHeader (node:_http_outgoing:651:3)
    at Request.request (/home/bot/smee/node_modules/superagent/lib/node/index.js:873:39)
    at Request.end (/home/bot/smee/node_modules/superagent/lib/node/index.js:989:8)
    at Client.onmessage (/home/bot/smee/node_modules/smee-client/index.js:35:13)
    at EventSource.emit (node:events:514:28)
    at _emit (/home/bot/smee/node_modules/eventsource/lib/eventsource.js:264:17)
    at parseEventStreamLine (/home/bot/smee/node_modules/eventsource/lib/eventsource.js:279:9)
    at IncomingMessage.<anonymous> (/home/bot/smee/node_modules/eventsource/lib/eventsource.js:238:11)
    at IncomingMessage.emit (node:events:514:28)
    at addChunk (node:internal/streams/readable:324:12) {
  code: 'ERR_INVALID_CHAR'
}

It doesn't really give enough information to understand why/for which message it crashed, but based on timings I already had an assumptions that it could be related to quoting bot messages. Now I just saw that @boegel did that in EESSI/software-layer#1116 (comment), and I checked the RISC-V and AWS bots right after that, and both had indeed crashed. So I guess smee cannot handle something in those messages, perhaps the emojis? Not sure if we can do something about it, but perhaps we can do some filtering somewhere?

Activity

  1. boegel commented on Jun 10, 2025

    @boegel
    Contributor

    Also happened on Deucalion, so CPU family has nothing to do with it.

  2. boegel commented on Jun 10, 2025

    @boegel
    Contributor

    This smells like a bug in smee to me. The event smee receives comes straight from GitHub, so I don't think we can do any filtering to prevent this from happening...

    We can try reporting it upstream via https://github.com/probot/smee-client ?

  3. boegel commented on Jun 12, 2025

    @boegel
    Contributor

    Updating the a newer version of smee-client should fix this problem.
    A bot using smee-client 2.0.4 has been known to be robust against this.

    I updated the bot instance for EESSI on the AWS cluster to smee-client version to 4.2.1 (by moving the node_modules directory and running npm install smee-client again). After also updating nodejs to 20.19, I then saw a failure to process an event for EESSI/software-layer-scripts#2 because there was a … at the end of the PR title:

    TypeError: Cannot convert argument to a ByteString because the character at index 664 has a value of 8230 which is greater than 255.
        at Client.fetch (/home/bot/smee/node_modules/undici/index.js:123:13)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async #onmessage (file:///home/bot/smee/node_modules/smee-client/index.js:39:30)
    

    It seems like that's a known unresolved problem in smee-client, see probot/smee-client#319

    The good news is that smee no longer crashes hard, it just reports that TypeError, and then keeps listening to additional events.

    A comment that includes an emoji (like EESSI/software-layer-scripts#2 (comment)) does trigger the TypeError, but the smee session doesn't crash anymore.

  4. bedroge commented on Jun 16, 2025

    @bedroge
    ContributorAuthor
  5. bedroge commented on Jun 27, 2025

    @bedroge
    ContributorAuthor

    The new Smee client from our container has been running on the RISC-V cluster for about two weeks now, and it hasn't crashed anymore. With the older client it would crash a few times per week. So it looks like this has indeed solved the issue, though I suppose we may still have to be careful with bot instructions that include emojis (I suspect that it will ignore them and report an error? But there's not much that we can do about it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions