sickn33/agentic-awesome-skills · error · Error
Order is cancelled
Error message
Order is cancelled
What it means
A business-rule throw inside fp-refactor's promise-chain processOrder: getOrder resolved successfully but its status is 'cancelled', so the pipeline aborts before inventory validation and payment. It shows conditionals-as-throws in promise chains.
Source
Thrown at skills/fp-refactor/SKILL.md:1156
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return response.json();
})
.then((data) => validateUserData(data))
.then((validData) => enrichUserProfile(validData))
.catch((error) => {
console.error('Failed to fetch user data:', error);
throw error;
});
}
// Chained promises with conditionals
function processOrder(orderId: string): Promise<OrderResult> {
return getOrder(orderId)
.then((order) => {
if (order.status === 'cancelled') {
throw new Error('Order is cancelled');
}
return order;
})
.then((order) => validateInventory(order))
.then((validOrder) => processPayment(validOrder))
.then((paidOrder) => shipOrder(paidOrder))
.catch((error) => {
logError(error);
return { success: false, error: error.message };
});
}
```
#### After (fp-ts TaskEither)
```typescript
import * as TE from 'fp-ts/TaskEither';
import * as E from 'fp-ts/Either';View on GitHub (pinned to 58d857988f)
Solutions
- Guard before calling: check order.status in the UI/service layer and block submission for cancelled orders
- Model status as a discriminated union so non-processable states fail to type-check
- Return E.left('Order is cancelled') (or a tagged OrderCancelled error) instead of throwing
Example fix
// before
if (order.status === 'cancelled') throw new Error('Order is cancelled')
// after: tagged, typed failure
if (order.status === 'cancelled')
return E.left({ _tag: 'OrderCancelled', orderId: order.id })
return E.right(order) Defensive patterns
Strategy: validation
Validate before calling
const isProcessable = (o: Order) => o.status !== 'cancelled' && o.status !== 'refunded'
Type guard
const isActiveOrder = (o: Order): o is Order & { status: 'active' } =>
o.status === 'active' Try / catch
processOrder(orderId).catch((e) => {
if (e instanceof Error && e.message === 'Order is cancelled') {
// inform user; do not retry
return
}
throw e
}) Prevention
- Check order status before submitting payment flows
- Model status as a discriminated union to make invalid states unrepresentable
When it happens
Trigger: Calling processOrder on an order whose status field equals 'cancelled' — user cancelled after checkout, or a duplicate submission reusing a cancelled order's id.
Common situations: Double-submitted checkout forms reusing cancelled orders; delayed fulfilment jobs picking up orders cancelled in between; status strings drifting between 'cancelled' and 'canceled'.
Related errors
AI-assisted analysis of sickn33/agentic-awesome-skills@58d857988f (2026-08-26).
Data as JSON: /api/errors/ebc6e0299bcfd6e9.
Report an issue: GitHub.