My scheduled AI job received only the first five words of its instructions
Incident log · September 2026
- What ran
- A nightly AI writing job, started by a scheduled script that hands the AI tool its instructions
- What I saw
- On the first test run, the AI tool received only the first five words of a long instruction file instead of the whole thing.
- Why
- The script passed the instructions as one command-line argument. Windows PowerShell 5.1 split that argument at the first double quote inside the text, which appeared around a quoted name a few words in.
- What it cost
- Caught in a test run before any unattended night. The AI noticed on its own that the instructions were incomplete and reported it.
- What changed
- The instructions now go in through standard input (piped in) instead of as an argument, with the pipe's text encoding set to UTF-8. The job that checks the drafts uses the same route.
What I expected
My content pipeline gets its drafts from a nightly job. At 02 a script starts an AI coding tool in non-interactive mode and hands it a long instruction file: which topics to take from a queue, how to write, what never to do. The tool writes the drafts; the script then checks them with fixed rules.
The first version of the script read the instruction file into a variable and passed it to the tool as a single command-line argument. The file was plain text. I expected the tool to receive all of it, the same way it does when I paste text into it by hand.
What actually happened
On the first test run, on September 28, the AI reported back that the instructions it had received were incomplete.
| What the script sent | What the tool received | |
|---|---|---|
| Instructions | The whole instruction file | The first five words |
| Where it stopped | — | At the first double quote, around a quoted name |
| Who noticed | — | The AI itself, which reported the instructions as incomplete |
Nothing crashed. The script started the tool, the tool started, and the tool exited. If the AI had simply tried to do something with five words, the run could easily have looked like a quiet night with nothing written.
Why
The script runs in Windows PowerShell 5.1, the version built into Windows. When it hands an argument to another program, it does not protect double quotes inside that argument. The receiving program reads the command line and treats the quote as the end of the argument. Everything after it was lost or read as something else.
A few words into my instructions, a name was written in double quotes. So the argument ended there.
This is the kind of failure that hides well:
- It depends on the content, not the code. The same script works with instructions that happen to contain no double quotes. A later edit to the instruction file, adding one quoted phrase, would have broken a job that had been working.
- Short tests pass. A quick test with a one-line prompt would never contain a quote.
- Every step reports success. The scheduler, the script and the tool all ran. That is the same shape as a publishing token that expired while every scheduled task still reported success.
What I changed
- The instructions go in through standard input. Instead of an argument, the script now pipes the instruction file into the tool. A pipe carries the text as it is; quotes inside it mean nothing special. The script has a one-line comment next to that line saying why, with the date of the test run.
- The pipe’s encoding is set to UTF-8. Windows PowerShell 5.1 sends text to another program’s standard input as ASCII by default, which would damage any character outside basic English. The script sets UTF-8 explicitly at the top.
- The second job uses the same route. Drafts are checked by a separate, read-only AI run. Its instructions are piped in the same way, so the fix covers both.
The fix is in how the text travels, not in the text. Banning double quotes from the instructions would only move the failure to whoever edits the file next.
What this has to do with hiring someone
If you hire someone to build a scheduled job that calls an AI tool (a nightly report, a content job, an agent that runs on a timer), the prompt is part of the input, and it travels from a script to the tool somehow. That handover is invisible in a demo and easy to get wrong on Windows.
Three things are worth putting in the brief or the acceptance test:
- Ask how long text reaches the tool: as a command-line argument, a file, or a pipe. For anything longer than a sentence, a file or a pipe is the safer answer.
- Test with awkward instructions: double quotes, an ampersand, a non-English character. If the job only works with clean text, it will break the first time someone edits the prompt.
- Log what was received: for the first runs, the job should record the length or the first lines of what the tool actually got, so a cut-off shows up in the log rather than in the output.
These sit naturally next to the scheduled-run tests in the acceptance checklist for unattended automations. If the job is part of an app someone built with an AI coding tool, the AI-built app job page has the acceptance lines to add them to.
What I put in a brief now
- Ask how long text such as prompts and message bodies gets from the script to the tool, and prefer a file or a pipe over a command-line argument.
- Ask for a test with instructions that contain quotes, ampersands and non-English characters.
- Ask for a first run that logs what the tool actually received, not only what was sent.