{"record":{"id":"ca60c10d84741205","repo":"angular/angular","slug":"the-provided-directive-was-not-found-in-the-applic","errorCode":null,"errorMessage":"The provided directive was not found in the application","messagePattern":"The provided directive was not found in the application","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/render3/context_discovery.ts","lineNumber":62,"sourceCode":"  if (mpValue) {\n    // only when it's an array is it considered an LView instance\n    // ... otherwise it's an already constructed LContext instance\n    if (isLView(mpValue)) {\n      const lView: LView = mpValue!;\n      let nodeIndex: number;\n      let component: any = undefined;\n      let directives: any[] | null | undefined = undefined;\n\n      if (isComponentInstance(target)) {\n        nodeIndex = findViaComponent(lView, target);\n        if (nodeIndex == -1) {\n          throw new Error('The provided component was not found in the application');\n        }\n        component = target;\n      } else if (isDirectiveInstance(target)) {\n        nodeIndex = findViaDirective(lView, target);\n        if (nodeIndex == -1) {\n          throw new Error('The provided directive was not found in the application');\n        }\n        directives = getDirectivesAtNodeIndex(nodeIndex, lView);\n      } else {\n        nodeIndex = findViaNativeElement(lView, target as RElement);\n        if (nodeIndex == -1) {\n          return null;\n        }\n      }\n\n      // the goal is not to fill the entire context full of data because the lookups\n      // are expensive. Instead, only the target data (the element, component, container, ICU\n      // expression or directive details) are filled into the context. If called multiple times\n      // with different target values then the missing target data will be filled in.\n      const native = unwrapRNode(lView[nodeIndex]);\n      const existingCtx = readPatchedData(native);\n      const context: LContext =\n        existingCtx && !Array.isArray(existingCtx)\n          ? existingCtx","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/angular/angular/blob/51cb07e98081ab7e4e84a9e0949266a8e19cca84/packages/core/src/render3/context_discovery.ts#L44-L80","documentation":"Error \"The provided directive was not found in the application\" thrown in angular/angular.","triggerScenarios":"Thrown at packages/core/src/render3/context_discovery.ts:62 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a directive instance that belongs to this application."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"51cb07e98081ab7e4e84a9e0949266a8e19cca84","analyzedAt":"2026-08-22T07:04:54.531Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}