evanw/esbuild · error · Error

Missing property "in" for entry point at index

Error message

Missing property "in" for entry point at index ${i}

What it means

When `entryPoints` is an array of objects (the input/output mapping form), each object must contain both `in` (the input path) and `out` (the output path). At lib/shared/common.ts:355 esbuild throws if `in` is missing, naming the offending index. The `out` property is checked similarly right after.

Solutions

  1. Add the `in` property with the source path to the entry-point object at the reported index.
  2. If you don't need output renaming, use the simpler string form: entryPoints: ['src/a.ts'].
  3. When generating objects, validate each has both `in` and `out` before calling build().

Example fix

// before
await build({ entryPoints: [{ out: 'dist/app.js' }], bundle: true })

// after
await build({ entryPoints: [{ in: 'src/app.ts', out: 'dist/app.js' }], bundle: true })
Defensive patterns

Strategy: validation

Validate before calling

function normalizeEntryPoints(entryPoints) {
  if (!Array.isArray(entryPoints)) return entryPoints
  entryPoints.forEach((ep, i) => {
    if (ep && typeof ep === 'object') {
      if (typeof ep.in !== 'string') throw new Error(`entryPoints[${i}] is missing string property "in"`)
      if (typeof ep.out !== 'string') throw new Error(`entryPoints[${i}] is missing string property "out"`)
    }
  })
  return entryPoints
}
options.entryPoints = normalizeEntryPoints(options.entryPoints)

Type guard

function isEntryPointObject(v): v is { in: string; out: string } {
  return !!v && typeof v === 'object'
    && typeof v.in === 'string' && typeof v.out === 'string'
}

Prevention

When it happens

Trigger: Passing `entryPoints: [{ out: 'dist/a.js' }]` (forgot `in`), or programmatically building entry objects and skipping the `in` field for some index.

Common situations: Generating entry-point objects from a glob and forgetting to populate `in`; renaming fields during a refactor; misreading docs and providing only `out`.

Related errors


AI-assisted analysis of evanw/esbuild@f6058f8364 (2026-08-09). Data as JSON: /api/errors/822d757f6517c733. Report an issue: GitHub.

Appendix: source

Thrown at lib/shared/common.ts:355

    }
  }
  if (outExtension) {
    for (let ext in outExtension) {
      if (ext.indexOf('=') >= 0) throw new Error(`Invalid out extension: ${ext}`)
      flags.push(`--out-extension:${ext}=${validateStringValue(outExtension[ext], 'out extension', ext)}`)
    }
  }

  if (entryPoints) {
    if (Array.isArray(entryPoints)) {
      for (let i = 0, n = entryPoints.length; i < n; i++) {
        let entryPoint = entryPoints[i]
        if (typeof entryPoint === 'object' && entryPoint !== null) {
          let entryPointKeys: OptionKeys = Object.create(null)
          let input = getFlag(entryPoint, entryPointKeys, 'in', mustBeString)
          let output = getFlag(entryPoint, entryPointKeys, 'out', mustBeString)
          checkForInvalidFlags(entryPoint, entryPointKeys, 'in entry point at index ' + i)
          if (input === undefined) throw new Error('Missing property "in" for entry point at index ' + i)
          if (output === undefined) throw new Error('Missing property "out" for entry point at index ' + i)
          entries.push([output, input])
        } else {
          entries.push(['', validateStringValue(entryPoint, 'entry point at index ' + i)])
        }
      }
    } else {
      for (let key in entryPoints) {
        entries.push([key, validateStringValue(entryPoints[key], 'entry point', key)])
      }
    }
  }

  if (stdin) {
    let stdinKeys: OptionKeys = Object.create(null)
    let contents = getFlag(stdin, stdinKeys, 'contents', mustBeStringOrUint8Array)
    let resolveDir = getFlag(stdin, stdinKeys, 'resolveDir', mustBeString)
    let sourcefile = getFlag(stdin, stdinKeys, 'sourcefile', mustBeString)

View on GitHub (pinned to f6058f8364)