{"record":{"id":"75289092cce97194","repo":"nilaoda/N_m3u8DL-RE","slug":"resstring-keyprocessornotfound","errorCode":null,"errorMessage":"ResString.keyProcessorNotFound","messagePattern":"ResString\\.keyProcessorNotFound","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/N_m3u8DL-RE.Parser/Extractor/HLSExtractor.cs","lineNumber":458,"sourceCode":"            // 由于播放器默认从最后3个分片开始播放 此处设置刷新间隔为TargetDuration的2倍\n            playlist.RefreshIntervalMs = (int)((playlist.TargetDuration ?? 5) * 2 * 1000);\n        }\n\n        return Task.FromResult(playlist);\n    }\n\n    private EncryptInfo ParseKey(string keyLine)\n    {\n        foreach (var p in ParserConfig.KeyProcessors)\n        {\n            if (p.CanProcess(ExtractorType, keyLine, M3u8Url, M3u8Content, ParserConfig))\n            {\n                // 匹配到对应处理器后不再继续\n                return p.Process(keyLine, M3u8Url, M3u8Content, ParserConfig);\n            }\n        }\n\n        throw new Exception(ResString.keyProcessorNotFound);\n    }\n\n    public async Task<List<StreamSpec>> ExtractStreamsAsync(string rawText)\n    {\n        this.M3u8Content = rawText;\n        this.PreProcessContent();\n        if (M3u8Content.Contains(HLSTags.ext_x_stream_inf))\n        {\n            Logger.Warn(ResString.masterM3u8Found);\n            var lists = await ParseMasterListAsync();\n            lists = lists.DistinctBy(p => p.Url).ToList();\n            return lists;\n        }\n\n        var playlist = await ParseListAsync();\n        return\n        [\n            new()","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/nilaoda/N_m3u8DL-RE/blob/e113dee70c924ee08dae5460624909b04d84cb76/src/N_m3u8DL-RE.Parser/Extractor/HLSExtractor.cs#L440-L476","documentation":"During HLS playlist parsing, an '#EXT-X-KEY' line was found but none of the registered key processors in ParserConfig.KeyProcessors could handle it, so ParseKey throws. This usually means the key scheme (e.g. a specific DRM or encryption format) has no matching processor registered.","triggerScenarios":"Parsing an m3u8 containing an EXT-X-KEY whose METHOD/URI format does not match any processor's CanCustomProcess/CanProcess check; the loop over ParserConfig.KeyProcessors completes without a return.","commonSituations":"Playlist uses SAMPLE-AES or an unsupported DRM key scheme, the key processor list was left empty/default and the required processor (e.g. for a specific AES-128 variant) was not registered, or the key line is malformed.","solutions":["Inspect the EXT-X-KEY line in the playlist to identify the METHOD and URI format.","Register/enable a key processor in ParserConfig.KeyProcessors that matches that key scheme (e.g. the AES or dedicated DRM processor).","Update N_m3u8DL-RE — newer versions add processors for more key formats.","If the content is DRM-protected and no processor exists, decryption is not supported; use another tool or an external decrypter.","Catch the error and report the localized ResString.keyProcessorNotFound to the user."],"exampleFix":"// before\nvar parserConfig = new ParserConfig(); // KeyProcessors left default\n\n// after\nvar parserConfig = new ParserConfig();\nparserConfig.KeyProcessors.Add(new AesKeyProcessor()); // handles METHOD=AES-128 style keys\n// or provide the key manually if it is known:\nparserConfig.CustomMethod = ...;","handlingStrategy":"try-catch","validationCode":"var keyLines = content.Split('\\n').Where(l => l.StartsWith(\"#EXT-X-KEY\"));\nforeach (var k in keyLines)\n    Console.WriteLine(k); // confirm METHOD is one your KeyProcessors support before parsing","typeGuard":null,"tryCatchPattern":"try { return await extractor.ExtractStreamsAsync(rawText); }\ncatch (Exception ex) when (ex.Message == ResString.keyProcessorNotFound)\n{ throw new NotSupportedException($\"Unsupported key scheme: {firstKeyLine}\"); }","preventionTips":["Register all needed key processors (AES-128, SAMPLE-AES variants) in ParserConfig.KeyProcessors before extraction.","Inspect EXT-X-KEY METHOD attributes in playlists for unsupported DRM schemes early.","Keep N_m3u8DL-RE updated for newly supported key formats."],"tags":["hls","drm","encryption","m3u8"],"backgroundTag":"missing-dependency","analyzedSha":"e113dee70c924ee08dae5460624909b04d84cb76","analyzedAt":"2026-09-13T02:43:21.078Z","contentChangedAt":"2026-09-13T02:43:21.078Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}