{"record":{"id":"d3eb6986960cc0e7","repo":"can1357/oh-my-pi","slug":"at-least-one-output-id-is-required-d3eb69","errorCode":null,"errorMessage":"At least one output ID is required","messagePattern":"At least one output ID is required","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"warning","filePath":"packages/coding-agent/src/eval/rb/prelude.rb","lineNumber":182,"sourceCode":"    end\n    current\n  end\n\n  def output(*ids, format: \"raw\", query: nil, offset: nil, limit: nil)\n    artifacts_dir = ENV[\"PI_ARTIFACTS_DIR\"]\n    if artifacts_dir.nil? || artifacts_dir.empty?\n      session_file = ENV[\"PI_SESSION_FILE\"]\n      if session_file.nil? || session_file.empty?\n        __omp_emit_status(\"output\", \"error\" => \"No session file available\")\n        raise \"No session - output artifacts unavailable\"\n      end\n      artifacts_dir = session_file.sub(/\\.[^.]*\\z/, \"\")\n    end\n    unless File.directory?(artifacts_dir)\n      __omp_emit_status(\"output\", \"error\" => \"Artifacts directory not found\", \"path\" => artifacts_dir)\n      raise \"No artifacts directory found: #{artifacts_dir}\"\n    end\n    raise ArgumentError, \"At least one output ID is required\" if ids.empty?\n    if query && (!offset.nil? || !limit.nil?)\n      __omp_emit_status(\"output\", \"error\" => \"query cannot be combined with offset/limit\")\n      raise ArgumentError, \"query cannot be combined with offset/limit\"\n    end\n\n    results = []\n    not_found = []\n    ids.each do |output_id|\n      path = File.join(artifacts_dir, \"#{output_id}.md\")\n      unless File.exist?(path)\n        not_found << output_id\n        next\n      end\n      raw = File.read(path, encoding: Encoding::UTF_8)\n      raw_lines = raw.split(\"\\n\", -1)\n      total_lines = raw_lines.length\n      selected = raw\n      range_info = nil","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/eval/rb/prelude.rb#L164-L200","documentation":"`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.","triggerScenarios":"`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.","commonSituations":"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).","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)`"],"exampleFix":"// before\nresults = output(*collected_ids)\n// after\nresults = collected_ids.empty? ? [] : output(*collected_ids)","handlingStrategy":"validation","validationCode":"raise ArgumentError, \"no output ids collected\" if ids.empty?\nresults = output(*ids)","typeGuard":null,"tryCatchPattern":"begin\n  results = output(*ids)\nrescue ArgumentError => e\n  raise unless e.message == \"At least one output ID is required\"\n  results = []\nend","preventionTips":["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"],"tags":["ruby","argumenterror","api-misuse"],"backgroundTag":"missing-required-argument","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}