clock_due_unreadable

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

A clock's due function can't give a date for the Service's own example order: it throws, or returns something that isn't a date. On a real order the clock would never open, and the owner console would alarm.

FixFails inSuggestsExit
Return a civil date such as '2027-04-15' from what the order has, or nothing until it has it.services/translation.ts:7 · clocks.deliver_by.dueclocks.deliver_by.due: job => job.input.<a date input>, such as '2027-04-15'1

Owned by Clocks: the page that explains what this gate holds.

npx services.dev check
  ✗ A clock's due function can't give a date for the Service's own example order: it throws, or returns something that isn't a date. On a real order the clock would never open, and the owner console would alarm. Return a civil date such as '2027-04-15' from what the order has, or nothing until it has it. clocks.deliver_by.due threw on the Service's example order: Cannot read properties of undefined (reading 'name').
    at services/translation.ts:7 · clocks.deliver_by.due
✗ 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' },
  clocks: { deliver_by: { due: job => `${job.output.document.name.slice(0, 10)}`, owner: 'buyer' } },
  price: 49,
})
git add -A && git diff --staged
diff --git a/services/translation.ts b/services/translation.ts
index 6eaf669..e60fa29 100644
--- a/services/translation.ts
+++ b/services/translation.ts
@@ -2,8 +2,8 @@ import { Service } from 'services.dev'
 
 export default Service({
   name: 'Translation',
-  input: { document: 'file', to: 'language: a BCP 47 tag, such as fr-CA' },
+  input: { document: 'file', to: 'language: a BCP 47 tag, such as fr-CA', needed_by: 'date: such as 2026-12-01' },
   output: { document: 'file' },
-  clocks: { deliver_by: { due: job => `${job.output.document.name.slice(0, 10)}`, owner: 'buyer' } },
+  clocks: { deliver_by: { due: job => job.input.needed_by, owner: 'buyer' } },
   price: 49,
 })
npx services.dev check
✓ ready to sell · 1 Service · AI delivers it alone · it keeps at least 80% of every job

How the tax example passes this gate, in lines read from its files.

examples/tax/lib/tax.ts
/** When the year's return is due in each jurisdiction: the statute's date, or a later one an extension the client already filed set. The calendar rolls it. */
export const fileDue = (job: AnyView, j: string) => [statutory(job, j), String(job.input.extended_to ?? '')].sort()[1] || statutory(job, j)
// …
/** The earliest date any carryforward expires: the subject's clock for them, from the job's own figures or what the taxpayer keeps. */
export const earliestExpiry = (job: AnyView) => ((job.output.carryforwards as Carryforward[] | undefined) ?? job.subject.fact<Carryforward[]>('carryforwards') ?? []).flatMap(c => (c.expires ? [c.expires] : [])).sort()[0] ?? ''
examples/tax/services/annual-return.ts
clocks: {
  file: { due: fileDue, each: { of: 'jurisdictions' }, owner: 'of_record', rungs: ['notice 90d', 'notice 30d', 'run tentative 3d', 'ack daily 5d'], moves: { extend: '6mo after due' } },
// …
  expiring: { due: earliestExpiry, owner: 'of_record', lives_on: 'subject', rungs: ['notice 180d'] },

Read them in context: Two clocks, Annual return.

npx services.dev check --json · the clock_due_unreadable failure
{
  "code": "clock_due_unreadable",
  "reason": "A clock's due function can't give a date for the Service's own example order: it throws, or returns something that isn't a date. On a real order the clock would never open, and the owner console would alarm.",
  "next": "Return a civil date such as '2027-04-15' from what the order has, or nothing until it has it. clocks.deliver_by.due threw on the Service's example order: Cannot read properties of undefined (reading 'name').",
  "doc_url": "https://services.dev/docs/reference/check/clock_due_unreadable",
  "file": "services/translation.ts",
  "line": 7,
  "path": "clocks.deliver_by.due",
  "suggest": {
    "path": "clocks.deliver_by.due",
    "value": "job => job.input.<a date input>, such as '2027-04-15'"
  }
}
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": 5,
      "steps": "draft · ai → review · ai · adversarial",
      "ok": false,
      "price": "$49 per job, within 48 hours, charged on delivery.",
      "who": "AI delivers every job.",
      "clocks": [