sickn33/agentic-awesome-skills · error · Error

No order

Error message

No order

What it means

Illustrative guard from the 'Chained Operations' BEFORE example: fetchOrder returned falsy, so the imperative chain aborts with 'No order'. The snippet's flat await + if-throw ladder is presented as the baseline the skill replaces with a composed TaskEither pipeline.

Source

Thrown at skills/fp-async/SKILL.md:931

// AFTER
const getUser = (id: string) =>
  TE.tryCatch(
    async () => {
      const res = await fetch(`/api/users/${id}`)
      if (!res.ok) throw new Error('Not found')
      return res.json()
    },
    E.toError
  )
```

### Chained Operations

```typescript
// BEFORE
async function processOrder(orderId: string) {
  const order = await fetchOrder(orderId)
  if (!order) throw new Error('No order')
  const user = await fetchUser(order.userId)
  if (!user) throw new Error('No user')
  const result = await chargePayment(user, order.total)
  return result
}

// AFTER
const processOrder = (orderId: string) =>
  pipe(
    TE.Do,
    TE.bind('order', () => fetchOrder(orderId)),
    TE.bind('user', ({ order }) => fetchUser(order.userId)),
    TE.chain(({ user, order }) => chargePayment(user, order.total))
  )
```

### Error Recovery

View on GitHub (pinned to 58d857988f)

Solutions

  1. Validate orderId (format/existence) before starting the chain
  2. Make fetchOrder distinguish missing (null) from failed (throw) instead of collapsing both
  3. Replace the if-throw ladder with pipe + TE.chain so each step's failure is a typed Left
  4. Return discriminated errors ({ kind: 'NoOrder' } etc.) so callers branch on cause

Example fix

// before
const order = await fetchOrder(orderId)
if (!order) throw new Error('No order')
// after
pipe(
  fetchOrderTask(orderId),
  TE.chain(order => order == null
    ? TE.left(new Error('No order'))
    : TE.right(order)),
  TE.chain(order => fetchUserTask(order.userId)),
  TE.chain(user => chargePaymentTask(user, order.total))
)
Defensive patterns

Strategy: validation

Validate before calling

const order = await fetchOrder(orderId)
if (order == null) return { kind: 'NoOrder', orderId }

Type guard

const isOrder = (o: unknown): o is Order =>
  typeof o === 'object' && o !== null && 'userId' in o && Array.isArray((o as Order).items)

Try / catch

try {
  const order = await fetchOrder(orderId)
  if (!order) throw new Error('No order')
} catch (e) {
  if (e instanceof Error && e.message === 'No order') return { kind: 'NoOrder', orderId }
  throw e
}

Prevention

When it happens

Trigger: processOrder invoked with an orderId that does not exist, was deleted, or whose fetch failed softly (returned undefined); also fires when fetchOrder's API returns 404 mapped to null.

Common situations: Client sends stale or malformed ids; retry logic reusing an id after deletion; API layer normalizing errors to null and thereby erasing the failure reason.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of sickn33/agentic-awesome-skills@58d857988f (2026-08-26). Data as JSON: /api/errors/673370eff5d5622d. Report an issue: GitHub.