can1357/oh-my-pi · error · FileNotFoundError

Output not found: \n\nAvailable outputs: (and more)

Error message

Output not found: {', '.join(not_found)}\n\nAvailable outputs: {', '.join(available[:20])} (and {len(available) - 20} more)

What it means

After iterating the requested ids, `output()` raises this FileNotFoundError if any id had no corresponding `<id>.md` file in the artifacts directory. The message lists every missing id and up to 20 available output ids (plus a count of the rest) to help you correct the lookup.

Solutions

  1. Use the 'Available outputs' list in the error message to pick the correct id.
  2. Enumerate the artifacts directory (session `.jsonl` path minus extension) with `glob('*.md')` and match ids before calling.
  3. Re-run the tool call that should have produced the artifact if it's genuinely missing.

Example fix

// before
ids = ["tool_9", "tool_10"]
result = output(ids)

// after
import pathlib
available = {p.stem for p in pathlib.Path(artifacts_dir).glob("*.md")}
ids = [i for i in ("tool_9", "tool_10") if i in available]
result = output(ids) if ids else None
Defensive patterns

Strategy: validation

Validate before calling

import pathlib
available = {p.stem for p in pathlib.Path(artifacts_dir).glob("*.md")}
missing = [i for i in ids if i not in available]
if missing:
    print(f"skipping missing: {missing}")
    ids = [i for i in ids if i in available]

Try / catch

try:
    result = output(ids)
except FileNotFoundError as e:
    msg = str(e)
    available_section = msg.split("Available outputs:")[-1].split("\n")[0]
    print(f"ids not found; available: {available_section}")
    result = None

Prevention

When it happens

Trigger: Calling `output(["tool_9"])` where `tool_9.md` doesn't exist; typo'd ids; querying a previous session's ids against a different run's artifacts directory.

Common situations: Referring to tool-call ids from memory instead of the session; artifacts directory cleared or regenerated between runs; ids from one eval session used while pointed at another session's artifacts.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

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

                }
                if range_info:
                    result_data["range"] = range_info
                if query:
                    result_data["query"] = query
                results.append(result_data)
            else:
                results.append({"id": output_id, "content": selected_content})

        # Handle not found
        if not_found:
            available = sorted([f.stem for f in Path(artifacts_dir).glob("*.md")])
            error_msg = f"Output not found: {', '.join(not_found)}"
            if available:
                error_msg += f"\n\nAvailable outputs: {', '.join(available[:20])}"
                if len(available) > 20:
                    error_msg += f" (and {len(available) - 20} more)"
            _emit_status("output", not_found=not_found, available_count=len(available))
            raise FileNotFoundError(error_msg)

        # Return format
        if len(ids) == 1:
            if format == "json":
                _emit_status("output", id=ids[0], chars=results[0]["char_count"])
                return results[0]
            _emit_status("output", id=ids[0], chars=len(results[0]["content"]))
            return results[0]["content"]

        # Multiple IDs
        if format == "json":
            total_chars = sum(r["char_count"] for r in results)
            _emit_status("output", count=len(results), total_chars=total_chars)
            return results

        combined_output: list[dict] = []
        for r in results:
            combined_output.append({"id": r["id"], "content": r["content"]})

View on GitHub (pinned to 9690622007)