{"record":{"id":"2c1d671e851e88d9","repo":"hcengineering/platform","slug":"platform-status-resourcenotfound","errorCode":"platform.status.ResourceNotFound","errorMessage":"Resource not found","messagePattern":"Resource not found","errorType":"http","errorClass":"PlatformError","httpStatus":404,"severity":"error","filePath":"packages/integration-client/src/request.ts","lineNumber":86,"sourceCode":"    const text = await response.text()\n    if (text.trim() === '') {\n      return undefined\n    }\n\n    try {\n      return JSON.parse(text)\n    } catch (error) {\n      console.warn('Failed to parse JSON response:', text, error)\n      return undefined\n    }\n  } else if (response.status === 202) {\n    return undefined\n  } else if (response.status === 401) {\n    throw new PlatformError(new Status(Severity.ERROR, platform.status.Unauthorized, {}))\n  } else if (response.status === 403) {\n    throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))\n  } else if (response.status === 404) {\n    throw new PlatformError(\n      new Status(Severity.ERROR, platform.status.ResourceNotFound, { resource: options.path ?? '' })\n    )\n  } else if (response.status >= 500) {\n    throw new PlatformError(new Status(Severity.ERROR, platform.status.InternalServerError, {}))\n  } else {\n    throw new PlatformError(new Status(Severity.ERROR, platform.status.BadRequest, { status: response.status }))\n  }\n}\n","sourceCodeStart":68,"sourceCodeEnd":95,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/integration-client/src/request.ts#L68-L95","documentation":"The integration client maps HTTP 404 responses to PlatformError with status.ResourceNotFound and message 'Resource not found', including the request path in the status params. The endpoint path or the resource addressed by the request does not exist on the server.","triggerScenarios":"Any request() call where the integration service responds with HTTP status 404; options.path is echoed in the error params.","commonSituations":"Wrong or outdated base URL / API version; integration key referenced in the path no longer exists; mistyped endpoint path; resource deleted concurrently.","solutions":["Check options.path and the client base URL for typos or stale values.","Confirm the resource (e.g., integration) still exists before operating on it.","Verify the client's API version matches the deployed service version.","Handle 404 gracefully in callers for delete-once flows (idempotent handling)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const exists = await client.getIntegration(integrationKey)\nif (exists == null) throw new Error(`Resource ${integrationKey} does not exist; nothing to do`)","typeGuard":"function isResourceNotFound (err: unknown): err is PlatformError {\n  return err instanceof PlatformError && (err.status.code as number) === platform.status.ResourceNotFound\n}","tryCatchPattern":"try {\n  await client.request(...)\n} catch (err) {\n  if (isResourceNotFound(err)) {\n    // inspect err.status.params.resource for the offending path\n  } else {\n    throw err\n  }\n}","preventionTips":["Check resource existence before update/delete operations.","Keep base URL and API version in sync with the deployed service.","Treat not-found as success in idempotent delete flows."],"tags":["http-404","not-found","rest"],"backgroundTag":"resource-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}