openai/codex · error · TypeError

unsupported input item: {type(item)!r}

Error message

unsupported input item: {type(item)!r}

What it means

Error "unsupported input item: {type(item)!r}" thrown in openai/codex.

Source

Thrown at sdk/python/src/openai_codex/_inputs.py:61


InputItem = TextInput | ImageInput | LocalImageInput | SkillInput | MentionInput
Input = list[InputItem] | InputItem
RunInput = Input | str


def _to_wire_item(item: InputItem) -> JsonObject:
    if isinstance(item, TextInput):
        return {"type": "text", "text": item.text}
    if isinstance(item, ImageInput):
        return {"type": "image", "url": item.url}
    if isinstance(item, LocalImageInput):
        return {"type": "localImage", "path": item.path}
    if isinstance(item, SkillInput):
        return {"type": "skill", "name": item.name, "path": item.path}
    if isinstance(item, MentionInput):
        return {"type": "mention", "name": item.name, "path": item.path}
    raise TypeError(f"unsupported input item: {type(item)!r}")


def _to_wire_input(input: Input) -> list[JsonObject]:
    if isinstance(input, list):
        return [_to_wire_item(i) for i in input]
    return [_to_wire_item(input)]


def _normalize_run_input(input: RunInput) -> Input:
    if isinstance(input, str):
        return TextInput(input)
    return input

View on GitHub (pinned to 339751715c)

Solutions

  1. Pass only supported input item types such as strings or the SDK input objects; convert the offending item before submitting.

When it happens

Trigger: Thrown at sdk/python/src/openai_codex/_inputs.py:61 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/ba359457363842db. Report an issue: GitHub.