{"record":{"id":"c062742bd7037823","repo":"mem0ai/mem0","slug":"missing-filters-or-schema","errorCode":null,"errorMessage":"Missing filters or schema","messagePattern":"Missing filters or schema","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mem0-ts/src/client/mem0.ts","lineNumber":764,"sourceCode":"    this._captureEvent(\"feedback\", [payloadKeys]);\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v1/feedback/`,\n      {\n        method: \"POST\",\n        headers: this.headers,\n        body: JSON.stringify(camelToSnakeKeys(data)),\n      },\n    );\n    return response;\n  }\n\n  async createMemoryExport(\n    data: CreateMemoryExportPayload,\n  ): Promise<{ message: string; id: string }> {\n    this._captureEvent(\"create_memory_export\", []);\n\n    if (!data.filters || !data.schema) {\n      throw new Error(\"Missing filters or schema\");\n    }\n\n    // filters and schema are user-controlled blobs whose keys must reach the\n    // API verbatim; only the remaining SDK params (e.g. exportInstructions)\n    // get camel->snake conversion. See issue #5593.\n    const { filters, schema, ...rest } = data;\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v1/exports/`,\n      {\n        method: \"POST\",\n        headers: this.headers,\n        body: JSON.stringify({\n          ...camelToSnakeKeys(rest),\n          filters,\n          schema,\n        }),\n      },\n    );","sourceCodeStart":746,"sourceCodeEnd":782,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/client/mem0.ts#L746-L782","documentation":"Thrown by MemoryClient.createMemoryExport() when the payload lacks either filters or schema. Both are required by the POST /v1/exports/ endpoint: filters select which memories to export and schema defines the output shape. The SDK validates synchronously so you get a clear local error instead of a 400 from the API. Note filters and schema are passed through verbatim (no camelCase->snake_case key conversion) per issue #5593.","triggerScenarios":"Calling createMemoryExport({ filters: {...} }) with no schema, or ({ schema: {...} }) with no filters, or passing an empty object / undefined for either field. Also hit when constructing the payload from a variable that is conditionally populated (e.g. filters only set in one branch).","commonSituations":"Copying a partial example from docs; assuming schema has a server-side default; passing snake_cased payload keys that TypeScript did not catch because the object was built as any.","solutions":["Supply both fields: await client.createMemoryExport({ filters: { user_id: 'u1' }, schema: { type: 'object', properties: {...} } })","Check the CreateMemoryExportPayload type — both filters and schema are non-optional; let the compiler catch the omission by typing your payload variable","Keep filter/schema keys exactly as the API expects — they are NOT key-converted, so snake_case inside these blobs is preserved verbatim"],"exampleFix":"// before\nawait client.createMemoryExport({ filters: { userId: 'u1' } } as any);\n\n// after\nawait client.createMemoryExport({\n  filters: { user_id: 'u1' },\n  schema: {\n    type: 'object',\n    properties: { memory: { type: 'string' } },\n  },\n});","handlingStrategy":"type-guard","validationCode":"if (!payload.filters || typeof payload.filters !== 'object') throw new Error('filters required');\nif (!payload.schema || typeof payload.schema !== 'object') throw new Error('schema required');\nawait client.createMemoryExport(payload);","typeGuard":"import type { CreateMemoryExportPayload } from 'mem0ai/oss';\nconst isCreateExportPayload = (\n  p: Partial<CreateMemoryExportPayload>,\n): p is CreateMemoryExportPayload =>\n  !!p.filters && typeof p.filters === 'object' &&\n  !!p.schema && typeof p.schema === 'object';","tryCatchPattern":"try {\n  const { id } = await client.createMemoryExport(payload);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Missing filters or schema') {\n    // local validation failure — fix payload construction, do not retry as-is\n    throw new Error('Export payload incomplete: build both filters and schema');\n  }\n  throw e;\n}","preventionTips":["Type every export payload as CreateMemoryExportPayload so the compiler enforces both fields","Build payloads from a factory function that always sets filters and schema","Remember filters/schema keys are passed through verbatim — use the API's own casing inside those blobs"],"tags":["exports","hosted-api","validation","typescript"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}