---
title: "clock_due_unreadable"
url: https://services.dev/docs/reference/check/clock_due_unreadable
---
# clock_due_unreadable

URL: https://services.dev/docs/reference/check/clock_due_unreadable

> 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.

| Fix | Fails in | Suggests | Exit |
|---|---|---|---|
| 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.due` | `clocks.deliver_by.due: job => job.input.<a date input>, such as '2027-04-15'` | 1 |

**Owned by** [Clocks](https://services.dev/docs/service/clocks.md): the page that explains what this gate holds.

## What check says

```txt title="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
```

## The failing file

```ts title="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,
})
```

## The fix

```diff title="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,
 })
```

```txt title="npx services.dev check"
✓ ready to sell · 1 Service · AI delivers it alone · it keeps at least 80% of every job
```

## In the tax example

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

```ts title="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] ?? ''
```

```ts title="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](https://services.dev/docs/examples/tax/deadline.md), [Annual return](https://services.dev/docs/examples/tax/annual-return.md).

## Explained in

- [Clocks](https://services.dev/docs/service/clocks.md)
- [Dates at risk](https://services.dev/docs/operate/dates.md)
- [A date the world sets](https://services.dev/docs/grow/clock.md)

## What an agent reads

```json title="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'"
  }
}
```

<details>
<summary>The whole document check --json prints</summary>

```json title="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": [
        "deliver_by · a date your code decides · the buyer"
      ],
      "agent": {
        "tool": "order_translation",
        "words": 24,
        "job": "job_7Hq2",
        "status": "accepted",
        "on": null,
        "charged": 4900,
        "person": false,
        "why": ""
      },
      "ledger": "+$49.00 · AI $0.84 (example) · you $48.16",
      "approved_ledger": null,
      "outcome": null,
      "margin": {
        "floor": {
          "cents": 3920,
          "pct": 80
        },
        "own": 3920,
        "stop": 980,
        "nested": []
      },
      "apps": [
        "customer portal",
        "owner console"
      ],
      "failures": [
        {
          "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'"
          }
        }
      ]
    }
  ]
}
```

</details>

---

- Up: [check’s gates](https://services.dev/docs/reference/check.md)
- Previous: [clock_unowned](https://services.dev/docs/reference/check/clock_unowned.md)
- Next: [price_below_cost](https://services.dev/docs/reference/check/price_below_cost.md)
