can1357/oh-my-pi · error · ValueError

At least one output ID is required

Error message

At least one output ID is required

What it means

The `output()` helper in the eval Python prelude reads tool-output artifacts stored as `<id>.md` files in the run's artifacts directory. It throws this ValueError when called with an empty or missing `ids` argument, because there is nothing to look up. The library refuses to guess which artifact you meant or return an empty result set.

Source

Thrown at packages/coding-agent/src/eval/py/prelude.py:191

        # Prefer PI_ARTIFACTS_DIR so subagents resolve through the parent's
        # shared artifacts dir; fall back to deriving from PI_SESSION_FILE
        # for legacy callers / top-level sessions where the two coincide.
        artifacts_dir = os.environ.get("PI_ARTIFACTS_DIR")
        if not artifacts_dir:
            session_file = os.environ.get("PI_SESSION_FILE")
            if not session_file:
                _emit_status("output", error="No session file available")
                raise RuntimeError("No session - output artifacts unavailable")
            artifacts_dir = session_file.rsplit(".", 1)[0]  # Strip .jsonl extension
        if not Path(artifacts_dir).exists():
            _emit_status(
                "output", error="Artifacts directory not found", path=artifacts_dir
            )
            raise RuntimeError(f"No artifacts directory found: {artifacts_dir}")

        if not ids:
            _emit_status("output", error="No IDs provided")
            raise ValueError("At least one output ID is required")

        if query and (offset is not None or limit is not None):
            _emit_status("output", error="query cannot be combined with offset/limit")
            raise ValueError("query cannot be combined with offset/limit")

        results: list[dict] = []
        not_found: list[str] = []

        for output_id in ids:
            output_path = Path(artifacts_dir) / f"{output_id}.md"
            if not output_path.exists():
                not_found.append(output_id)
                continue

            raw_content = output_path.read_text(encoding="utf-8")
            raw_lines = raw_content.splitlines()
            total_lines = len(raw_lines)

View on GitHub (pinned to 9690622007)

Solutions

  1. Pass at least one output id: `output(["tool_1"])` or `output("tool_1")`.
  2. If ids are computed, check the list is non-empty before calling and handle the empty case in your eval script.
  3. If you don't know the ids, inspect the artifacts directory (`<session>.jsonl` path minus extension) or enumerate available outputs via the host tooling first.

Example fix

// before
ids = [c["id"] for c in calls if c["ok"]]
result = output(ids)

// after
ids = [c["id"] for c in calls if c["ok"]]
if not ids:
    raise SystemExit("no successful tool calls to inspect")
result = output(ids)
Defensive patterns

Strategy: validation

Validate before calling

if not ids:
    raise SystemExit("output() called with no ids; nothing to read")

Try / catch

try:
    result = output(ids)
except ValueError as e:
    if "At least one output ID" in str(e):
        result = None

Prevention

When it happens

Trigger: Calling `output()` with no arguments, `output(ids=[])`, or `output(ids=None)` — any call where `ids` is falsy.

Common situations: Building the id list programmatically from a variable that turned out empty (e.g. a filtered list of tool-call ids matched nothing), or copying an example call and dropping the ids argument assuming a default.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/9b30ca925ddbc3c2. Report an issue: GitHub.