Skip to content

harbor_view stops with UnicodeEncodeError when export writes task.toml for a task.yaml whose metadata holds a lone surrogate #759

Open

Description

@antonwolfy

A terminal-bench task.yaml with difficulty: "n\udcff" (a YAML escape) loads with that lone surrogate in task.metadata. harbor_view (dokimi/dokimi/harnesses/harbor_export.py:71) calls _content_key(task.path, _task_toml(task)) and then export, which writes (dest / "task.toml").write_text(_task_toml(task), encoding="utf-8") at line 141 and raises UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 44: surrogates not allowed (traceback ends in pathlib write_text). The key is fixed by #720; the write is not a hash, and surrogatepass there would write a task.toml that is not valid UTF-8. Fix options: refuse a metadata value that is not valid text in tbench_v1.read with a message naming the key, or drop the escape on export.

Found while fixing #720. The fix's PR is #761.

Activity

  1. self-assigned this
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions