Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

HarmonyError: Unexpected EOS while waiting for message header to complete

Open
#33 9 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python, rust

Research direction

Run the supplied Python example and start at openai_harmony/init.py around parse_messages_from_completion_tokens, then trace the Rust-side inner parser it calls. Determine why the rendered token sequence ends with an incomplete message header; done means the example parses successfully without HarmonyError and returns the expected messages.

Written by the indexing model from the issue text.

Description

Summary:
Running the example code from the openai_harmony repository results in a HarmonyError when calling parse_messages_from_completion_tokens(...).

Steps to Reproduce:

from openai_harmony import (
    load_harmony_encoding,
    HarmonyEncodingName,
    Role,
    Message,
    Conversation,
    DeveloperContent,
    SystemContent,
)
enc = load_harmony_encoding(HarmonyEncodingName.HARMONY_GPT_OSS)
convo = Conversation.from_messages([
    Message.from_role_and_content(
        Role.SYSTEM,
        SystemContent.new(),
    ),
    Message.from_role_and_content(
        Role.DEVELOPER,
        DeveloperContent.new().with_instructions("Talk like a pirate!")
    ),
    Message.from_role_and_content(Role.USER, "Arrr, how be you?"),
])
tokens = enc.render_conversation_for_completion(convo, Role.ASSISTANT)
print(tokens)

#fails here <--
parsed = enc.parse_messages_from_completion_tokens(tokens, role=Role.ASSISTANT)
print(parsed)

It raised the following error while executing the last statement in the above example `parsed = enc.parse_messages_from_completion_tokens(tokens, role=Role.ASSISTANT).

Output and Traceback

[200006, 17360, 200008, 3575, 553, 17554, 162016, 11, 261, 4410, 6439, 2359, 22203, 656, 7788, 17527, 558, 87447, 100594, 25, 220, 1323, 19, 12, 3218, 279, 30377, 289, 25, 14093, 279, 2, 13888, 18403, 25, 8450, 11, 49159, 11, 1721, 13, 21030, 2804, 413, 7360, 395, 1753, 3176, 13, 200007, 200006, 77944, 200008, 2, 68406, 279, 37992, 1299, 261, 96063, 0, 200007, 200006, 1428, 200008, 8977, 81, 11, 1495, 413, 481, 30, 200007, 200006, 173781]
Traceback (most recent call last):
  File "/home/arun/experiments/gpt_oss.py", line 25, in <module>
    parsed = enc.parse_messages_from_completion_tokens(tokens, role=Role.ASSISTANT)
  File "/home/arun/miniconda3/envs/thcr/lib/python3.13/site-packages/openai_harmony/__init__.py", line 525, in parse_messages_from_completion_tokens
    raw_json: str = self._inner.parse_messages_from_completion_tokens(
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        list(tokens), None if role is None else str(role.value)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
openai_harmony.HarmonyError: Unexpected EOS while waiting for message header to complete

I checked the source code; however, the variable self._inner is bound to the Rust-side variable inner.

Dominant language
Rust
Stars
4.5k
Forks
315
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/harmony

All issues in openai/harmony

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.