"Please pass patch text through stdin" Error When Using -q Parameter

Resolved 💬 1 comment Opened May 29, 2025 by Yeqishen Closed Aug 7, 2025

What version of Codex is running?

0.1.2504161551

Which model were you using?

google/gemini-2.5-flash-preview-05-20

What platform is your computer?

Linux 6.10.14-linuxkit x86_64 unknown

What steps can reproduce the bug?

When using python subprocess executing codex with the -q parameter to pass query text via command line, the tool returns an error "Please pass patch text through stdin" and exits with code 1.

```import subprocess
import os

...

cmd_str = f"codex -a 'full-auto' --provider openrouter --model 'google/gemini-2.5-flash-preview-05-20' -q \"$(cat {task_description_path})\""

process = subprocess.Popen(
cmd_str,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
bufsize=1,
universal_newlines=True,
cwd="/tmp"
)

stdout, stderr = process.communicate()
print(f"Return code: {process.returncode}")
print(f"Output: {stdout}")


### What is the expected behavior?

I enter the command manually through the terminal it executes fine.

### What do you see instead?

ai response

### Additional information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗