{"record":{"id":"f8efadaf624108b3","repo":"parcel-bundler/parcel","slug":"only-one-spread-element-can-be-included-in-a-confi","errorCode":null,"errorMessage":"Only one spread element can be included in a config pipeline","messagePattern":"Only one spread element can be included in a config pipeline","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/core/src/requests/ParcelConfigRequest.js","lineNumber":660,"sourceCode":"function assertPurePipeline(\n  pipeline: ExtendableParcelConfigPipeline,\n): PureParcelConfigPipeline {\n  return pipeline.map(s => {\n    invariant(typeof s !== 'string');\n    return s;\n  });\n}\n\nexport function mergePipelines(\n  base: ?ExtendableParcelConfigPipeline,\n  ext: ?ExtendableParcelConfigPipeline,\n): ExtendableParcelConfigPipeline {\n  if (ext == null) {\n    return base ?? [];\n  }\n\n  if (ext.filter(v => v === '...').length > 1) {\n    throw new Error(\n      'Only one spread element can be included in a config pipeline',\n    );\n  }\n\n  // Merge the base pipeline if a rest element is defined\n  let spreadIndex = ext.indexOf('...');\n  if (spreadIndex >= 0) {\n    return [\n      ...ext.slice(0, spreadIndex),\n      ...(base ?? []),\n      ...ext.slice(spreadIndex + 1),\n    ];\n  } else {\n    return ext;\n  }\n}\n\nexport function mergeMaps<K: string, V>(","sourceCodeStart":642,"sourceCodeEnd":678,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/core/src/requests/ParcelConfigRequest.js#L642-L678","documentation":"Thrown by mergePipelines() when the extending pipeline (ext) contains more than one '...' spread element. The spread element is used to insert the base pipeline's contents at a specific position; only one insertion point is allowed per pipeline to keep merge semantics unambiguous.","triggerScenarios":"mergePipelines(base, ext) is called during config chain processing when a child .parcelrc extends a parent. If the ext pipeline array filters to more than one element equal to '...', the error fires before any merging occurs.","commonSituations":"Writing a custom .parcelrc pipeline with multiple '...' entries thinking they each insert the base at different positions; copy-pasting pipeline fragments that each had their own spread; misunderstanding that '...' represents the entire base pipeline, not a per-position placeholder.","solutions":["Keep only one '...' in each pipeline array — it represents the entire inherited base pipeline.","Place the single '...' where you want the base plugins to run: before your additions, after them, or in between.","If you need base plugins in two positions, explicitly list the base plugin names instead of using two spreads."],"exampleFix":"// before — .parcelrc\n{\n  \"extends\": \"@parcel/config-default\",\n  \"transformers\": {\n    \"*.js\": [\"...\", \"my-plugin\", \"...\"]\n  }\n}\n\n// after — single spread\n{\n  \"extends\": \"@parcel/config-default\",\n  \"transformers\": {\n    \"*.js\": [\"my-plugin\", \"...\"]\n}","handlingStrategy":"validation","validationCode":"function validatePipelineSpreadCount(pipeline) {\n  if (!Array.isArray(pipeline)) return;\n  const spreadCount = pipeline.filter(v => v === '...').length;\n  if (spreadCount > 1) {\n    throw new Error(`Pipeline has ${spreadCount} spread elements ('...'); only one is allowed.`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember that '...' represents the entire inherited base pipeline — use it once.","If you need base plugins in multiple positions, list them by name explicitly.","Review the Parcel config merging documentation before writing complex pipelines."],"tags":["parcelrc","pipeline","config","spread","merge"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}