{"record":{"id":"4e78d78c61f6ee8b","repo":"App-vNext/Polly","slug":"unable-to-find-a-resilience-pipeline-associated-wi","errorCode":null,"errorMessage":"Unable to find a resilience pipeline associated with the key '{key}'. Please ensure that either the resilience pipeline or the builder is registered.","messagePattern":"Unable to find a resilience pipeline associated with the key '(.+?)'\\. Please ensure that either the resilience pipeline or the builder is registered\\.","errorType":"exception","errorClass":"KeyNotFoundException","httpStatus":null,"severity":"error","filePath":"src/Polly.Core/Registry/ResiliencePipelineProvider.cs","lineNumber":25,"sourceCode":"/// </summary>\n/// <typeparam name=\"TKey\">The type of the key.</typeparam>\npublic abstract class ResiliencePipelineProvider<TKey>\n    where TKey : notnull\n{\n    /// <summary>\n    /// Retrieves a resilience pipeline from the provider using the specified key.\n    /// </summary>\n    /// <param name=\"key\">The key used to identify the resilience pipeline.</param>\n    /// <returns>The resilience pipeline associated with the specified key.</returns>\n    /// <exception cref=\"KeyNotFoundException\">Thrown when no resilience pipeline is found for the specified key.</exception>\n    public virtual ResiliencePipeline GetPipeline(TKey key)\n    {\n        if (TryGetPipeline(key, out var pipeline))\n        {\n            return pipeline;\n        }\n\n        throw new KeyNotFoundException($\"Unable to find a resilience pipeline associated with the key '{key}'. \" +\n            $\"Please ensure that either the resilience pipeline or the builder is registered.\");\n    }\n\n    /// <summary>\n    /// Retrieves a generic resilience pipeline from the provider using the specified key.\n    /// </summary>\n    /// <typeparam name=\"TResult\">The type of result that the resilience pipeline handles.</typeparam>\n    /// <param name=\"key\">The key used to identify the resilience pipeline.</param>\n    /// <returns>The resilience pipeline associated with the specified key.</returns>\n    /// <exception cref=\"KeyNotFoundException\">Thrown when no resilience pipeline is found for the specified key.</exception>\n    public virtual ResiliencePipeline<TResult> GetPipeline<TResult>(TKey key)\n    {\n        if (TryGetPipeline<TResult>(key, out var pipeline))\n        {\n            return pipeline;\n        }\n\n        throw new KeyNotFoundException($\"Unable to find a generic resilience pipeline of '{typeof(TResult).Name}' associated with the key '{key}'. \" +","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/App-vNext/Polly/blob/d0e46bdb1ee11ea50d0e4b6846d2633d6bc09bac/src/Polly.Core/Registry/ResiliencePipelineProvider.cs#L7-L43","documentation":"ResiliencePipelineProvider<TKey>.GetPipeline(key) throws KeyNotFoundException when TryGetPipeline returns false for the given key. The provider is the read-side of the registry; the key must have been registered beforehand either as a built pipeline or as a builder. The message tells you neither the pipeline nor its builder was registered under that key.","triggerScenarios":"Calling registry.GetPipeline(\"my-key\") when only a different key, a generic pipeline, or nothing was registered; looking up by a key that was registered on a different ResiliencePipelineRegistry instance.","commonSituations":"Typo in the key string; key registered after first resolution (lazy registration ordering); using the wrong registry in multi-tenant setups; registering only a generic pipeline (GetPipeline<TResult>) but calling the non-generic GetPipeline.","solutions":["Register the pipeline or builder under the exact key via registry.TryAddPipeline(...) / TryAddBuilder(...) before resolving.","Use TryGetPipeline(key, out var pipeline) to guard resolution instead of GetPipeline when the key may be absent.","Verify the key value, type, and comparer used by the registry match what you registered."],"exampleFix":"// before\nvar pipeline = provider.GetPipeline(\"order-api\"); // throws if not registered\n\n// after\nregistry.TryAddPipeline(\"order-api\", builder => builder.AddRetry(new()));\n// later\nif (provider.TryGetPipeline(\"order-api\", out var pipeline)) { /* use */ }","handlingStrategy":"validation","validationCode":"// Resolve defensively:\nif (provider.TryGetPipeline(key, out var pipeline)) {\n    // use pipeline\n} else {\n    // register or handle absence\n}","typeGuard":null,"tryCatchPattern":"try { var p = provider.GetPipeline(key); }\ncatch (KeyNotFoundException ex) when (ex.Message.Contains(key)) {\n    // log, register on demand, or fall back to a default pipeline\n}","preventionTips":["Register all expected keys at startup (TryAddPipeline/TryAddBuilder) before resolving.","Prefer TryGetPipeline over GetPipeline when absence is a legitimate runtime state.","Centralize key strings as constants to avoid typos."],"tags":["registry","key-not-found","pipeline-provider","configuration","polly-core"],"backgroundTag":null,"analyzedSha":"d0e46bdb1ee11ea50d0e4b6846d2633d6bc09bac","analyzedAt":"2026-08-13T16:36:01.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}