can1357/oh-my-pi · warning · ArgumentError
At least one output ID is required
Error message
At least one output ID is required
What it means
`output(*ids)` requires at least one artifact ID to fetch; it raises ArgumentError immediately after validating the artifacts directory when `ids` is empty. Calling `output()` with no arguments is a caller bug — there is nothing to look up.
Source
Thrown at packages/coding-agent/src/eval/rb/prelude.rb:182
end
current
end
def output(*ids, format: "raw", query: nil, offset: nil, limit: nil)
artifacts_dir = ENV["PI_ARTIFACTS_DIR"]
if artifacts_dir.nil? || artifacts_dir.empty?
session_file = ENV["PI_SESSION_FILE"]
if session_file.nil? || session_file.empty?
__omp_emit_status("output", "error" => "No session file available")
raise "No session - output artifacts unavailable"
end
artifacts_dir = session_file.sub(/\.[^.]*\z/, "")
end
unless File.directory?(artifacts_dir)
__omp_emit_status("output", "error" => "Artifacts directory not found", "path" => artifacts_dir)
raise "No artifacts directory found: #{artifacts_dir}"
end
raise ArgumentError, "At least one output ID is required" if ids.empty?
if query && (!offset.nil? || !limit.nil?)
__omp_emit_status("output", "error" => "query cannot be combined with offset/limit")
raise ArgumentError, "query cannot be combined with offset/limit"
end
results = []
not_found = []
ids.each do |output_id|
path = File.join(artifacts_dir, "#{output_id}.md")
unless File.exist?(path)
not_found << output_id
next
end
raw = File.read(path, encoding: Encoding::UTF_8)
raw_lines = raw.split("\n", -1)
total_lines = raw_lines.length
selected = raw
range_info = nilView on GitHub (pinned to 9690622007)
Solutions
- Check the ID list before calling: `raise "no outputs" if ids.empty?` or branch to a no-op / alternate summary path
- If you have an Array, splat it and guard: `ids.empty? ? [] : output(*ids)`
- If a single Array was passed positionally, splat it: `output(*list)` instead of `output(list)`
Example fix
// before results = output(*collected_ids) // after results = collected_ids.empty? ? [] : output(*collected_ids)
Defensive patterns
Strategy: validation
Validate before calling
raise ArgumentError, "no output ids collected" if ids.empty? results = output(*ids)
Try / catch
begin results = output(*ids) rescue ArgumentError => e raise unless e.message == "At least one output ID is required" results = [] end
Prevention
- Guard dynamically-collected ID arrays for emptiness before splatting into output
- Remember output takes splatted IDs, not a single Array argument
- Treat an empty ID list as a meaningful state (phase produced nothing) and branch explicitly
When it happens
Trigger: `output()` called with no positional arguments — commonly the result of building the ID list dynamically (`output(*my_ids)` where `my_ids` is empty) or forwarding optional args from a wrapper without a default.
Common situations: A pipeline step collects sub-agent output IDs at runtime; if the earlier phase produced no outputs the splatted array is empty and `output(*ids)` hits this error. Also happens when refactoring `output("id")` into `output(ids)` (passing an Array as a single positional instead of splatting).
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
- query cannot be combined with offset/limit
- tool.#{name}(...) expects a Hash of arguments (got #{positio
- No messages to continue from
- Cannot continue from message role: assistant
- Gemini Files API cannot delete a handle from another provide
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/d3eb6986960cc0e7.
Report an issue: GitHub.