sickn33/agentic-awesome-skills · error · Error

Order not found

Error message

Order not found

What it means

This error comes from the imperative 'Before' example in the fp-pragmatic skill's Promise-to-TaskEither section. fetchOrder returned a falsy value (null/undefined), meaning no order with that id exists, and the code converts that into a thrown Error.

Source

Thrown at skills/fp-pragmatic/SKILL.md:503

        ? E.right(obj.email)
        : E.left('Valid email required')
    ),
    E.bind('age', ({ obj }) =>
      typeof obj.age === 'number' && obj.age >= 0
        ? E.right(obj.age)
        : E.left('Valid age required')
    ),
    E.map(({ email, age }) => ({ email, age }))
  )
```

### Promise Chain to TaskEither

```typescript
// Before
async function processOrder(orderId: string): Promise<Receipt> {
  const order = await fetchOrder(orderId)
  if (!order) throw new Error('Order not found')

  const validated = await validateOrder(order)
  if (!validated.success) throw new Error(validated.error)

  const payment = await processPayment(validated.order)
  if (!payment.success) throw new Error('Payment failed')

  return generateReceipt(payment)
}

// After
const processOrder = (orderId: string): TE.TaskEither<string, Receipt> =>
  pipe(
    fetchOrderTE(orderId),
    TE.flatMap(order =>
      order ? TE.right(order) : TE.left('Order not found')
    ),
    TE.flatMap(validateOrderTE),

View on GitHub (pinned to 58d857988f)

Solutions

  1. Verify the order id exists via a GET before processing, or surface a typed 404 to the client
  2. Check that you are querying the correct environment/database
  3. Convert the pipeline to TE.TaskEither as the skill's 'After' shows, mapping a null fetch to TE.left('Order not found')

Example fix

// before
const order = await fetchOrder(orderId)
if (!order) throw new Error('Order not found')

// after
const getOrder = (id: string) =>
  TE.tryCatch(() => fetchOrder(id), E.toError)
// then chain a null-check returning TE.left('Order not found')
Defensive patterns

Strategy: try-catch

Type guard

const isOrder = (x: unknown): x is Order =>
  typeof x === 'object' && x !== null && 'id' in x && 'status' in x

Try / catch

try {
  await processOrder(orderId)
} catch (e) {
  if (e instanceof Error && e.message === 'Order not found') {
    // return 404 to caller
  }
  throw e
}

Prevention

When it happens

Trigger: Calling processOrder(orderId) where fetchOrder resolves to null or undefined — wrong id, deleted order, or a lookup against the wrong environment's database.

Common situations: Stale ids from emails or cached UIs; environment mismatch (id exists in staging but not production); deleted or archived records; race where the order is cancelled between listing and processing.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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