{"record":{"id":"340dd927b4a66134","repo":"Meituan-Dianping/mpvue","slug":"injection-key-not-found-340dd9","errorCode":null,"errorMessage":"Injection \"${key}\" not found","messagePattern":"Injection \"(.+?)\" not found","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/instance/inject.js","lineNumber":60,"sourceCode":"    // inject is :any because flow is not smart enough to figure out cached\n    const result = Object.create(null)\n    const keys = hasSymbol\n        ? Reflect.ownKeys(inject)\n        : Object.keys(inject)\n\n    for (let i = 0; i < keys.length; i++) {\n      const key = keys[i]\n      const provideKey = inject[key]\n      let source = vm\n      while (source) {\n        if (source._provided && provideKey in source._provided) {\n          result[key] = source._provided[provideKey]\n          break\n        }\n        source = source.$parent\n      }\n      if (process.env.NODE_ENV !== 'production' && !hasOwn(result, key)) {\n        warn(`Injection \"${key}\" not found`, vm)\n      }\n    }\n    return result\n  }\n}\n","sourceCodeStart":42,"sourceCodeEnd":66,"githubUrl":"https://github.com/Meituan-Dianping/mpvue/blob/6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b/src/core/instance/inject.js#L42-L66","documentation":"Raised by resolveInject after it walks the entire ancestor chain (via source.$parent) without finding the requested provideKey in any ancestor's _provided store. The inject entry resolved to no provider: either no ancestor declares a matching provide key, the provide/inject key strings mismatch (provide uses a different key name than inject requests), or the providing component is not actually an ancestor of the injecting one.","triggerScenarios":"Thrown at src/core/instance/inject.js:60 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a provide entry in an ancestor component whose key matches the inject key exactly (or fix the key name mismatch between provide and inject)","If the injection is genuinely optional, use the object syntax with a default: inject: { foo: { default: () => ({}) } }","Verify the providing component is actually rendered as an ancestor in the component tree, not a sibling or child"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b","analyzedAt":"2026-09-02T05:17:40.946Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}