{"record":{"id":"a94b91084df0a8f9","repo":"remix-run/remix","slug":"cannot-install-context-property-formattedproperty-a94b91","errorCode":null,"errorMessage":"Cannot install context property {formattedProperty} because it already exists on RequestContext.","messagePattern":"Cannot install context property (.+?) because it already exists on RequestContext\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/fetch-router/src/lib/request-context.ts","lineNumber":324,"sourceCode":"    if (existingProperty != null && existingProperty !== property) {\n      throw new Error(\n        `Cannot install context property ${formattedProperty} because this context key already uses ${JSON.stringify(existingProperty)}.`,\n      )\n    }\n\n    let existingKey = this.#contextProperties.get(property)\n    if (existingKey != null) {\n      if (existingKey !== key) {\n        throw new Error(\n          `Cannot install context property ${formattedProperty} because another context key already uses it.`,\n        )\n      }\n\n      return\n    }\n\n    if (property in this) {\n      throw new Error(\n        `Cannot install context property ${formattedProperty} because it already exists on RequestContext.`,\n      )\n    }\n\n    this.#contextProperties.set(property, key)\n    this.#contextPropertyKeys.set(key, property)\n\n    Object.defineProperty(this, property, {\n      get: () => this.get(key),\n    })\n  }\n\n  #router?: Router<any>\n\n  /**\n   * The router handling this request.\n   */\n  get router(): Router<RequestContext<any, entries>> {","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/fetch-router/src/lib/request-context.ts#L306-L342","documentation":"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.","triggerScenarios":"ctx.set(key, v, { property: 'router' }) or 'request', 'url', 'set' — any name already present on RequestContext instances.","commonSituations":"Middleware wanting a convenient ctx.params or ctx.url accessor that clashes with built-in context members.","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'"],"exampleFix":"// before\nctx.set(key, v, { property: 'request' })\n// after\nctx.set(key, v, { property: 'rawRequest' })","handlingStrategy":"validation","validationCode":"if (property in ctx) throw new Error('property shadows RequestContext member')","typeGuard":"const isBuiltIn = (ctx: object, p: string) => p in ctx","tryCatchPattern":null,"preventionTips":["Avoid names like request, router, url, set, params for custom properties","Prefix custom context properties"],"tags":["request-context","fetch-router","middleware"],"backgroundTag":"invalid-context-property","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}