{"record":{"id":"401e594922f696f8","repo":"mem0ai/mem0","slug":"index-parameter-key-must-be-an-integer-betwee","errorCode":null,"errorMessage":"Index parameter '${key}' must be an integer between ${range[0]} and ${range[1]}","messagePattern":"Index parameter '(.+?)' must be an integer between (.+?) and (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/vector_stores/oracledb.ts","lineNumber":392,"sourceCode":"\n  private validateIndexParameters(\n    parameters?: Record<string, number>,\n  ): Record<string, number> {\n    if (!parameters) return {};\n\n    const allowed = INDEX_PARAMETER_RANGES[this.indexType];\n    const validated: Record<string, number> = {};\n\n    for (const [key, value] of Object.entries(parameters)) {\n      const range = allowed[key];\n      if (!range) {\n        throw new Error(\n          `Unsupported ${this.indexType} index parameter '${key}'. ` +\n            `Allowed: ${Object.keys(allowed).join(\", \")}`,\n        );\n      }\n      if (!Number.isInteger(value) || value < range[0] || value > range[1]) {\n        throw new Error(\n          `Index parameter '${key}' must be an integer between ${range[0]} and ${range[1]}`,\n        );\n      }\n      validated[key] = value;\n    }\n\n    return validated;\n  }\n\n  async initialize(): Promise<void> {\n    if (!this._initPromise) {\n      this._initPromise = this._doInitialize().catch(async (error) => {\n        if (this.ownsClient && this.client) {\n          await Promise.resolve(this.client.close()).catch(() => {});\n          this.client = undefined;\n          this.ownsClient = false;\n        }\n        this._initPromise = undefined;","sourceCodeStart":374,"sourceCodeEnd":410,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/vector_stores/oracledb.ts#L374-L410","documentation":"Beyond key validation (error 274), every index parameter value must be an integer inside the type-specific range from INDEX_PARAMETER_RANGES: HNSW neighbors 2–2048, efconstruction 1–65535; IVF neighbor partitions 1–10000000, samples_per_partition 1–MAX_SAFE_INTEGER, min_vectors_per_partition 0–MAX_SAFE_INTEGER.","triggerScenarios":"HNSW { neighbors: 1 } (below minimum 2); { efconstruction: 0 }; IVF { 'neighbor partitions': 0 }; non-integer values like { neighbors: 64.5 }; values parsed from env strings producing NaN.","commonSituations":"Aggressive tuning experiments (neighbors=1, efconstruction=0) that fall below Oracle's legal bounds; float math on config values; copy-pasted numbers from other engines whose ranges differ (e.g. pgvector's ef_construction can be small but Oracle's floor is 1).","solutions":["Clamp to the documented ranges: neighbors 2–2048, efconstruction 1–65535, neighbor partitions ≥ 1.","Round non-integers: Math.max(min, Math.min(max, Math.round(v))).","Validate env-sourced numbers with Number.isInteger before passing them in.","If unsure, omit indexParameters — Oracle applies sensible defaults."],"exampleFix":"// before\nindexParameters: { neighbors: 1, efconstruction: 0 }\n\n// after\nindexParameters: { neighbors: 32, efconstruction: 400 }","handlingStrategy":"validation","validationCode":"function clampInt(name: string, v: number, [min, max]: [number, number]): number {\n  const n = Math.round(v);\n  if (n < min || n > max) throw new RangeError(`${name}=${v} out of range [${min}, ${max}]`);\n  return n;\n}","typeGuard":"const inRange = (v: unknown, min: number, max: number): v is number => typeof v === 'number' && Number.isInteger(v) && v >= min && v <= max;","tryCatchPattern":null,"preventionTips":["Validate tuning values against the documented ranges before constructing the store.","Prefer omitting indexParameters unless you have measured a need."],"tags":["oracle","config","index","validation","ranges"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}