agent_cannot_buy

The running jobjob_7Hq2 · delivered · document.fr-CA.pdf · $49.00 charged

An agent couldn't order, wait for and accept a job.

FixFails inExit
Run npx services.dev dev and read its job.services/translation.ts1

Owned by Build with your coding agent: the page that explains what this gate holds.

npx services.dev check
  ✗ An agent couldn't order, wait for and accept a job. Run npx services.dev dev and read its job. It stopped at: draft: Cannot read properties of undefined (reading 'map').
    https://services.dev/docs/reference/check/agent_cannot_buy
✗ 1 to fix
services/translation.ts
import { Service } from 'services.dev'

export default Service({
  name: 'Translation',
  input: { document: 'file', to: 'language: a BCP 47 tag, such as fr-CA' },
  output: { document: 'file' },
  deliver: async ({ document, to }) => {
    const pages = document.pages.map(page => page.text)
    return { document: { name: `${document.name}.${to}`, text: pages.join('\n') } }
  },
  price: 49,
})
git add -A && git diff --staged
diff --git a/services/translation.ts b/services/translation.ts
index 820ccb4..e7fd1f6 100644
--- a/services/translation.ts
+++ b/services/translation.ts
@@ -5,7 +5,7 @@ export default Service({
   input: { document: 'file', to: 'language: a BCP 47 tag, such as fr-CA' },
   output: { document: 'file' },
   deliver: async ({ document, to }) => {
-    const pages = document.pages.map(page => page.text)
+    const pages = (await document.text()).split('\f')
     return { document: { name: `${document.name}.${to}`, text: pages.join('\n') } }
   },
   price: 49,
npx services.dev check
✓ ready to sell · 1 Service · AI delivers it alone · it keeps at least 80% of every job
npx services.dev check --json · the agent_cannot_buy failure
{
  "code": "agent_cannot_buy",
  "reason": "An agent couldn't order, wait for and accept a job.",
  "next": "Run npx services.dev dev and read its job. It stopped at: draft: Cannot read properties of undefined (reading 'map').",
  "doc_url": "https://services.dev/docs/reference/check/agent_cannot_buy"
}
The whole document check --json prints
npx services.dev check --json
{
  "ai": {
    "cents_per_call": 42,
    "simulated": true
  },
  "mcp": {
    "tools": 13,
    "tokens": 4486,
    "sandbox": 9,
    "budget": 8000
  },
  "services": [
    {
      "path": "services/translation.ts",
      "lines": 8,
      "steps": "draft · code → review · ai · adversarial",
      "ok": false,
      "price": "$49 per job, within 48 hours, charged on delivery.",
      "who": "AI delivers every job.",
      "agent": {