{"record":{"id":"02d85690f5a20494","repo":"lancedb/lancedb","slug":"expected-a-map-type-to-have-an-array-like-childre","errorCode":null,"errorMessage":"Expected a Map type to have an array-like `children` property","messagePattern":"Expected a Map type to have an array-like `children` property","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"nodejs/lancedb/sanitize.ts","lineNumber":358,"sourceCode":"  if (typeLike.children.length !== 1) {\n    throw Error(\"Expected a FixedSizeList type to have exactly one child\");\n  }\n  return new FixedSizeList(\n    typeLike.listSize,\n    sanitizeFieldWithContext(typeLike.children[0], context),\n  );\n}\n\nexport function sanitizeMap(typeLike: object) {\n  return sanitizeMapWithContext(typeLike, createSanitizationContext());\n}\n\nfunction sanitizeMapWithContext(\n  typeLike: object,\n  context: SanitizationContext,\n) {\n  if (!(\"children\" in typeLike) || !Array.isArray(typeLike.children)) {\n    throw Error(\n      \"Expected a Map type to have an array-like `children` property\",\n    );\n  }\n  if (!(\"keysSorted\" in typeLike) || typeof typeLike.keysSorted !== \"boolean\") {\n    throw Error(\"Expected a Map type to have a `keysSorted` property\");\n  }\n  if (typeLike.children.length !== 1) {\n    throw Error(\"Expected a Map type to have exactly one child\");\n  }\n\n  return new Map_(\n    sanitizeFieldWithContext(typeLike.children[0], context),\n    typeLike.keysSorted,\n  );\n}\n\nexport function sanitizeDuration(typeLike: object) {\n  if (!(\"unit\" in typeLike) || typeof typeLike.unit !== \"number\") {","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/lancedb/lancedb/blob/c7b051aff7039333a3f61b79217246c27676806a/nodejs/lancedb/sanitize.ts#L340-L376","documentation":"A Map type is rebuilt from a `children` array (containing the single entries struct field) plus `keysSorted`. This error is thrown when `children` is missing or not an Array, so the entries field cannot be recovered.","triggerScenarios":"Calling sanitizeTypeById (directly or via sanitizeMap) on a Map-like object without an array `children` — e.g. {} or {keysSorted: false, entries: f}, or children set to a non-array value.","commonSituations":"Hand-written schema JSON omitting the entries/children array; serializing from a library that stores map children under a different key (e.g. `entries`); version drift where serialization keys changed; typos in hand-edited schemas.","solutions":["Add an array `children` property containing the single entries Field.","Rename alternative keys (e.g. `entries`) to `children`.","Ensure the child is a valid serializable Field object.","Regenerate the schema by serializing a genuine Arrow Map type."],"exampleFix":"// before\nsanitizeTypeById(-1, { keysSorted: false, entries: f }); // Map code\n// after\nsanitizeTypeById(-1, { keysSorted: false, children: [entriesField] });","handlingStrategy":"type-guard","validationCode":"function assertMapLike(t) {\n  if (!t || !Array.isArray(t.children)) {\n    throw new Error('Map type object must have an array `children` property');\n  }\n}\nassertMapLike(typeLike); // before sanitizeTypeById","typeGuard":"function isMapLike(t) {\n  return typeof t === 'object' && t !== null && Array.isArray(t.children);\n}","tryCatchPattern":"try {\n  const m = sanitizeMap(typeLike, context);\n} catch (e) {\n  if (String(e.message).includes('array-like `children`')) {\n    console.error('Map type missing children:', JSON.stringify(typeLike));\n  } else { throw e; }\n}","preventionTips":["Serialize map types with `children` holding the single entries field.","Rename foreign keys like `entries` to `children` before sanitizing.","Keep map columns in schema round-trip tests.","Version-pin LanceDB to avoid serialization key drift."],"tags":["typescript","schema","arrow","map"],"backgroundTag":"schema-validation-failed","analyzedSha":"c7b051aff7039333a3f61b79217246c27676806a","analyzedAt":"2026-09-08T23:42:37.579Z","contentChangedAt":"2026-09-08T23:42:37.579Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}