HarmonyError: Unexpected EOS while waiting for message header to complete
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
- Domain
- backend-api-design
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
- 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.
More from openai/harmony
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Rendering is quadratic in the length of a single messagePossibly taken @rksharma-owg claimed this 47 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Python asyncio eventloop run_in_executor with ThreadPoolExecutor is not workingPossibly taken @Gnoale claimed this 208 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
bug easy good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
lacs-project/sysknife#659 ·
Maintainers usually reply within 2 days
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
registrystack/registry-stack#2431 ·
Maintainers usually reply within 1 day
-
contribution
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
farion1231/cc-switch#8863 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
DioxusLabs/dioxus#6006 ·
Maintainers usually reply within 1 day