{"record":{"id":"862b2ede65bc75a2","repo":"withastro/astro","slug":"reservedslotname","errorCode":"ReservedSlotName","errorMessage":"Unable to create a slot named `${slotName}`. `${slotName}` is a reserved slot name. Please update the name of this slot.","messagePattern":"Unable to create a slot named `(.+?)`\\. `(.+?)` is a reserved slot name\\. Please update the name of this slot\\.","errorType":"validation","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/core/render/slots.ts","lineNumber":36,"sourceCode":"\t\treturn getFunctionExpression(expression);\n\t}\n\treturn expression as (...args: any[]) => any;\n}\n\nexport class Slots {\n\t#result: SSRResult;\n\t#slots: ComponentSlots | null;\n\t#logger: AstroLogger;\n\n\tconstructor(result: SSRResult, slots: ComponentSlots | null, logger: AstroLogger) {\n\t\tthis.#result = result;\n\t\tthis.#slots = slots;\n\t\tthis.#logger = logger;\n\n\t\tif (slots) {\n\t\t\tfor (const key of Object.keys(slots)) {\n\t\t\t\tif ((this as any)[key] !== undefined) {\n\t\t\t\t\tthrow new AstroError({\n\t\t\t\t\t\t...AstroErrorData.ReservedSlotName,\n\t\t\t\t\t\tmessage: AstroErrorData.ReservedSlotName.message(key),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tObject.defineProperty(this, key, {\n\t\t\t\t\tget() {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t},\n\t\t\t\t\tenumerable: true,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic has(name: string) {\n\t\tif (!this.#slots) return false;\n\t\treturn Boolean(this.#slots[name]);\n\t}","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/core/render/slots.ts#L18-L54","documentation":"A named slot's name collided with an existing property on the Slots instance (e.g. 'has', 'render', 'result'). The Slots class defines accessors for each slot name, so names that shadow its own methods/fields are rejected to prevent breaking slot lookups.","triggerScenarios":"Defining <slot name=\"has\" />, <slot name=\"render\" />, or any name matching a Slots prototype property; passing a slot whose name equals an internal method.","commonSituations":"Choosing slot names like 'name', 'length', 'render', 'has' that overlap with built-in object members; programmatic slot generation that picks reserved words.","solutions":["Rename the slot to something that is not a property of the Slots class (avoid 'has', 'render', 'result', 'prop', etc.).","Check the reserved collision by confirming the name is not already a method on the component's slot helper.","Use a domain-specific prefix for slot names to avoid accidental collisions."],"exampleFix":"// before\n<slot name=\"render\" />\n\n// after\n<slot name=\"content\" />","handlingStrategy":"validation","validationCode":"const RESERVED = new Set(['has','render','result','prop','name','length','constructor','prototype']);\nfunction isReservedSlotName(name: string): boolean {\n  return RESERVED.has(name);\n}\n// guard slot names before defining them","typeGuard":"function isSafeSlotName(name: string): boolean {\n  return !(['has','render','result','prop','name','length'] as string[]).includes(name);\n}","tryCatchPattern":null,"preventionTips":["Avoid method-like slot names (has, render, result).","Use domain-specific slot names (header, footer, content).","When generating slots programmatically, validate against a reserved-name list."],"tags":["slots","components","naming"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}