remix-run/remix · error · Error
Cannot install context property {formattedProperty} because
Error message
Cannot install context property {formattedProperty} because it already exists on RequestContext. What it means
A context property name cannot shadow real members of the RequestContext class (like request, router, or set). This error fires when the property name collides with an existing own/inherited property on the context object.
Source
Thrown at packages/fetch-router/src/lib/request-context.ts:324
if (existingProperty != null && existingProperty !== property) {
throw new Error(
`Cannot install context property ${formattedProperty} because this context key already uses ${JSON.stringify(existingProperty)}.`,
)
}
let existingKey = this.#contextProperties.get(property)
if (existingKey != null) {
if (existingKey !== key) {
throw new Error(
`Cannot install context property ${formattedProperty} because another context key already uses it.`,
)
}
return
}
if (property in this) {
throw new Error(
`Cannot install context property ${formattedProperty} because it already exists on RequestContext.`,
)
}
this.#contextProperties.set(property, key)
this.#contextPropertyKeys.set(key, property)
Object.defineProperty(this, property, {
get: () => this.get(key),
})
}
#router?: Router<any>
/**
* The router handling this request.
*/
get router(): Router<RequestContext<any, entries>> {View on GitHub (pinned to 9696913134)
Solutions
- Pick a distinct property name (e.g. 'routeParams' instead of 'params' if built-in)
- Read built-in members directly instead of installing them as context properties
- Namespace custom properties: 'appParams', 'authSession'
Example fix
// before
ctx.set(key, v, { property: 'request' })
// after
ctx.set(key, v, { property: 'rawRequest' }) Defensive patterns
Strategy: validation
Validate before calling
if (property in ctx) throw new Error('property shadows RequestContext member') Type guard
const isBuiltIn = (ctx: object, p: string) => p in ctx
Prevention
- Avoid names like request, router, url, set, params for custom properties
- Prefix custom context properties
When it happens
Trigger: ctx.set(key, v, { property: 'router' }) or 'request', 'url', 'set' — any name already present on RequestContext instances.
Common situations: Middleware wanting a convenient ctx.params or ctx.url accessor that clashes with built-in context members.
Related errors
- Context property name must be a string.
- Cannot install an empty context property name.
- Cannot install context property {formattedProperty} because
- Cannot install context property {formattedProperty} because
- next() called multiple times
AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27).
Data as JSON: /api/errors/a94b91084df0a8f9.
Report an issue: GitHub.