{"record":{"id":"114afd4fae39f397","repo":"sickn33/agentic-awesome-skills","slug":"no-user","errorCode":null,"errorMessage":"No user","messagePattern":"No user","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"skills/fp-async/SKILL.md","lineNumber":933,"sourceCode":"  TE.tryCatch(\n    async () => {\n      const res = await fetch(`/api/users/${id}`)\n      if (!res.ok) throw new Error('Not found')\n      return res.json()\n    },\n    E.toError\n  )\n```\n\n### Chained Operations\n\n```typescript\n// BEFORE\nasync function processOrder(orderId: string) {\n  const order = await fetchOrder(orderId)\n  if (!order) throw new Error('No order')\n  const user = await fetchUser(order.userId)\n  if (!user) throw new Error('No user')\n  const result = await chargePayment(user, order.total)\n  return result\n}\n\n// AFTER\nconst processOrder = (orderId: string) =>\n  pipe(\n    TE.Do,\n    TE.bind('order', () => fetchOrder(orderId)),\n    TE.bind('user', ({ order }) => fetchUser(order.userId)),\n    TE.chain(({ user, order }) => chargePayment(user, order.total))\n  )\n```\n\n### Error Recovery\n\n```typescript\n// BEFORE","sourceCodeStart":915,"sourceCodeEnd":951,"githubUrl":"https://github.com/sickn33/agentic-awesome-skills/blob/58d857988fcfac6986206bca2b2fe223aa437e4b/skills/fp-async/SKILL.md#L915-L951","documentation":"This error is thrown by an illustrative BEFORE code sample in the fp-async skill documentation (skills/fp-async/SKILL.md:933). It demonstrates the imperative pattern of manually checking each awaited result in an async chain and throwing stringly-typed Errors when a lookup fails; the doc contrasts it with a TaskEither pipeline where failures are expressed in the return type. It is not thrown by any real library code.","triggerScenarios":"Calling the documented processOrder(orderId) example when fetchUser(order.userId) resolves to a falsy value (null/undefined), e.g. the order references a userId that no longer exists in the user store.","commonSituations":"Copy-pasting the BEFORE example into real code; data-integrity issues where an order userId points at a deleted user; treating a missing related record as an exception rather than a domain result.","solutions":["Replace the throwing chain with the AFTER pattern shown in the same doc: model fetchOrder/fetchUser as TaskEither and use TE.bind/TE.chain so absence is a Left value, not an exception","If keeping imperative code, narrow the error with a typed error class instead of a bare Error","Check data integrity if the user genuinely should exist: verify the user record was not deleted and the userId field is correct"],"exampleFix":"// before\nconst user = await fetchUser(order.userId)\nif (!user) throw new Error('No user')\nconst result = await chargePayment(user, order.total)\n\n// after\nconst processOrder = (orderId: string) =>\n  pipe(\n    TE.Do,\n    TE.bind('order', () => fetchOrder(orderId)),\n    TE.bind('user', ({ order }) => fetchUser(order.userId)),\n    TE.chain(({ user, order }) => chargePayment(user, order.total))\n  )","handlingStrategy":"type-guard","validationCode":"const user = await fetchUser(order.userId)\nif (!user) {\n  return res.status(404).json({ error: 'user not found' })\n}","typeGuard":"const isUser = (u: unknown): u is User =>\n  typeof u === 'object' && u !== null && 'id' in u && 'email' in u","tryCatchPattern":null,"preventionTips":["Model lookups as TaskEither so absence is a Left, never an exception","Validate that related-record ids (order.userId) exist before charging payments"],"tags":["documentation-example","fp-ts","task-either","null-check"],"backgroundTag":"entity-not-found","analyzedSha":"58d857988fcfac6986206bca2b2fe223aa437e4b","analyzedAt":"2026-08-26T11:55:59.350Z","schemaVersion":2},"datasetVersion":"2026-08-26T14:46:13.012Z"}