hcengineering/platform · error · PlatformError

platform.status.ResourceNotFound

platform.status.ResourceNotFound

Error message

Resource not found

What it means

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.

Source

Thrown at packages/integration-client/src/request.ts:86

    const text = await response.text()
    if (text.trim() === '') {
      return undefined
    }

    try {
      return JSON.parse(text)
    } catch (error) {
      console.warn('Failed to parse JSON response:', text, error)
      return undefined
    }
  } else if (response.status === 202) {
    return undefined
  } else if (response.status === 401) {
    throw new PlatformError(new Status(Severity.ERROR, platform.status.Unauthorized, {}))
  } else if (response.status === 403) {
    throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
  } else if (response.status === 404) {
    throw new PlatformError(
      new Status(Severity.ERROR, platform.status.ResourceNotFound, { resource: options.path ?? '' })
    )
  } else if (response.status >= 500) {
    throw new PlatformError(new Status(Severity.ERROR, platform.status.InternalServerError, {}))
  } else {
    throw new PlatformError(new Status(Severity.ERROR, platform.status.BadRequest, { status: response.status }))
  }
}

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Check options.path and the client base URL for typos or stale values.
  2. Confirm the resource (e.g., integration) still exists before operating on it.
  3. Verify the client's API version matches the deployed service version.
  4. Handle 404 gracefully in callers for delete-once flows (idempotent handling).
Defensive patterns

Strategy: validation

Validate before calling

const exists = await client.getIntegration(integrationKey)
if (exists == null) throw new Error(`Resource ${integrationKey} does not exist; nothing to do`)

Type guard

function isResourceNotFound (err: unknown): err is PlatformError {
  return err instanceof PlatformError && (err.status.code as number) === platform.status.ResourceNotFound
}

Try / catch

try {
  await client.request(...)
} catch (err) {
  if (isResourceNotFound(err)) {
    // inspect err.status.params.resource for the offending path
  } else {
    throw err
  }
}

Prevention

When it happens

Trigger: Any request() call where the integration service responds with HTTP status 404; options.path is echoed in the error params.

Common situations: Wrong or outdated base URL / API version; integration key referenced in the path no longer exists; mistyped endpoint path; resource deleted concurrently.

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 hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/2c1d671e851e88d9. Report an issue: GitHub.