{"record":{"id":"22e557acae59849d","repo":"hcengineering/platform","slug":"result-error","errorCode":null,"errorMessage":"result.error","messagePattern":"result\\.error","errorType":"exception","errorClass":"PlatformError","httpStatus":null,"severity":"error","filePath":"foundations/core/packages/api-client/src/rest/rest.ts","lineNumber":306,"sourceCode":"      }\n      if (options.limit != null) {\n        params.append('limit', `${options.limit}`)\n      }\n      const requestUrl = concatLink(this.endpoint, `/api/v1/search-fulltext/${this.workspace}?${params.toString()}`)\n      const response = await fetch(requestUrl, {\n        method: 'GET',\n        headers: this.jsonHeaders(),\n        keepalive: true\n      })\n      if (!response.ok) {\n        await this.checkRateLimits(response)\n        throw new PlatformError(unknownError(response.statusText))\n      }\n      this.updateRateLimit(response)\n      return await extractJson<TxResult>(response)\n    })\n    if (result.error !== undefined) {\n      throw new PlatformError(result.error)\n    }\n    return result\n  }\n\n  async domainRequest<T>(\n    domain: OperationDomain,\n    params: DomainParams,\n    options?: DomainRequestOptions\n  ): Promise<DomainResult<T>> {\n    const requestUrl = concatLink(this.endpoint, `/api/v1/request/${domain}/${this.workspace}`)\n\n    await this.checkRate()\n    return await withRetry(async () => {\n      const response = await fetch(requestUrl, {\n        method: 'POST',\n        headers: this.jsonHeaders(),\n        keepalive: true,\n        body: JSON.stringify(params)","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/core/packages/api-client/src/rest/rest.ts#L288-L324","documentation":"searchFulltext wraps its request with withRetry; even on HTTP 200 the server can embed a Status error in the JSON body. If result.error is defined, the client throws a PlatformError carrying that Status. This is an application-level error reported by the server rather than a transport failure.","triggerScenarios":"Server processes the search request but responds with { error: Status } — e.g. invalid query parameters, workspace-level processing failure, or internal transactor error surfaced in the response body.","commonSituations":"Malformed query string rejected by the search engine, workspace data issues, server-side bug during fulltext indexing/lookup, version mismatch between client expectations and server response shape.","solutions":["Inspect result.error (Status.code/message) in a catch of PlatformError to learn the server-side cause.","Validate the query/params passed to searchFulltext against the server's expected format.","Check server logs for the correlating internal error.","Upgrade client/server to matching versions if the Status indicates an unknown/unsupported operation."],"exampleFix":"// before\nconst res = await client.searchFulltext(query, {})\n// after\ntry { const res = await client.searchFulltext(query, {}) }\ncatch (e) { if (e instanceof PlatformError) console.error('server status:', e.message); throw e }","handlingStrategy":"try-catch","validationCode":"// Validate query shape before sending; malformed input is a common cause of embedded Status errors\nif (typeof query !== 'string' || query.length > 512) throw new Error('query must be a reasonable-length string')","typeGuard":"function isPlatformError(e: unknown): e is PlatformError {\n  return e instanceof PlatformError\n}","tryCatchPattern":"try {\n  return await client.searchFulltext(query, {})\n} catch (e) {\n  if (isPlatformError(e)) {\n    // result.error was set by the server: inspect Status message for the app-level cause\n    console.error('Search failed server-side:', e.message)\n  }\n  throw e\n}","preventionTips":["Sanitize and limit query parameters before calling searchFulltext","Treat PlatformError messages as server Status payloads and route them to your logging/monitoring","Match client version to server so response shapes stay compatible"],"tags":["server-error","search","status"],"backgroundTag":"server-returned-error-status","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}