Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Skip Handling

path-binder does not throw errors when it encounters invalid data. Instead, it collects unprocessable entries in the skipped array and returns them alongside the result. This prevents a single bad row from halting the entire batch.

Inspecting Skipped Entries

import { generate } from 'path-binder'

const { result, skipped } = generate(input, { schema })

skipped.forEach((entry) => {
  console.log(entry.name)    // sheet name
  console.log(entry.index)   // row index
  console.log(entry.path)    // the problematic path string
  console.log(entry.value)   // cell value (stringified)
  console.log(entry.reason)  // skip reason code
})

skipScope Option

Controls the granularity of skipping.

skipScopeBehaviorRecommended For
'cell' (default)Only the invalid cell is skipped; other cells in the row are processedUser input data (tolerating minor gaps)
'row'If any cell in a row is invalid, the entire row is skippedStrict data conversion (preventing incomplete entities)
// Cell level: only invalid cells are skipped
const cellResult = generate(input, { skipScope: 'cell' })

// Row level: if any cell is invalid, the entire row is skipped
const rowResult = generate(input, { skipScope: 'row' })

Common Skips and How to Fix Them

empty — Empty Path Segment

Triggering input: "user..name" (double dots), "user." (trailing dot)

Fix: Check the path row and remove extra dots.

reference_not_found — No Matching Reference

Triggering input: Sheet2 has user.$id = 3, but Sheet1 has no user with id = 3

Fix: Verify that matching primary data exists in the referenced sheet.

cast — Cast Function Threw an Exception

Triggering input: asNumber() field receives "abc"

Fix: Check the input data, or add error handling in asCustom().


Skip Reasons Reference

Path Syntax Errors

CodeDescriptionExample Input
emptyPath segment is empty"user..name"
bracketUnclosed bracket ]"items[0"
indexNon-numeric array index"items[abc]"
unnamedNo property name before []"[]"
escapeNo name after $$ escape prefix"config.$$"
keyNo name after $ key prefix"user.$"

Reference Key Errors

CodeDescriptionExample Input
reference_not_foundNo matching primary row$id=3 but no primary id=3
no_primary_dataAll rows are reference rowsAll paths have $ prefix
conflicting_key_propSame row has $key and non-$key with same nameuser.$id and user.id in same row
nested_key$key inside array pathinfo[].$type
invalid_key_valueKey value is not a primitive$id value is an object
mixed_key_root$keys in same row belong to different root pathsuser.$id and order.$id in same row

Data Conflict & Cast Errors

CodeDescriptionExample Input
property_conflictReference data conflicts with primary dataBoth have different values for same property
castCast function threw an exceptionasNumber() receives "abc"

Skip Logging Patterns

Example of monitoring skips in production.

const { result, skipped } = generate(input, { schema })

// Log when skips occur
if (skipped.length > 0) {
  console.warn(`${skipped.length} entries were skipped`)
  skipped.forEach((s) => {
    console.warn(`  Sheet: ${s.name}, Row: ${s.index + 1}, Path: ${s.path}, Reason: ${s.reason}`)
  })
}

// Generate error report for user feedback
const errorReport = skipped.map((s) =>
  `Row ${s.index + 1}: "${s.path}" — ${s.reason}`
)

Next step: See the API Reference for all types and options