{"record":{"id":"f6d1d0a1377da7fc","repo":"jackwener/OpenCLI","slug":"error-f6d1d0","errorCode":null,"errorMessage":"字幕文件中没有字幕片段。","messagePattern":"字幕文件中没有字幕片段。","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"info","filePath":"clis/bilibili/subtitle.js","lineNumber":124,"sourceCode":"        let items;\n        try {\n            items = await page.evaluate(fetchJs);\n        }\n        catch (err) {\n            throw new CommandExecutionError(`字幕获取失败: ${err?.message || err}`);\n        }\n        if (items?.error) {\n            throw new CommandExecutionError(`字幕获取失败: ${items.error}${items.text ? ' — ' + items.text : ''}`);\n        }\n        if (!items || typeof items !== 'object' || items.success !== true) {\n            throw new CommandExecutionError('字幕获取结果对象不符合预期格式');\n        }\n        const finalItems = items.data;\n        if (!Array.isArray(finalItems)) {\n            throw new CommandExecutionError('解析到的字幕列表对象不符合数组格式');\n        }\n        if (finalItems.length === 0) {\n            throw new EmptyResultError('bilibili subtitle', '字幕文件中没有字幕片段。');\n        }\n        // 5. 数据映射\n        return finalItems.map((item, idx) => {\n            const from = Number(item?.from);\n            const to = Number(item?.to);\n            if (!item || typeof item !== 'object' || !Number.isFinite(from) || !Number.isFinite(to)) {\n                throw new CommandExecutionError('字幕片段缺少有效 from/to 时间戳');\n            }\n            return {\n                index: idx + 1,\n                from: from.toFixed(2) + 's',\n                to: to.toFixed(2) + 's',\n                content: String(item.content ?? '')\n            };\n        });\n    },\n});\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/bilibili/subtitle.js#L106-L142","documentation":"An EmptyResultError thrown when the CDN subtitle JSON parsed successfully and its cue list is an array, but the array has zero entries. The subtitle file exists and is valid — it just contains no subtitle lines.","triggerScenarios":"The subtitle JSON body array is empty: uploader created an empty CC track, or an AI-subtitle job produced no cues.","commonSituations":"Empty subtitle track uploaded by mistake; AI subtitle generation completed with no transcribable speech; muted/music-only videos with an auto-generated empty track.","solutions":["Verify in the web player whether the chosen subtitle track displays any lines.","Pick a different subtitle language/track via --lang if one exists.","Treat as 'no subtitles in this track' in your wrapper and fall back gracefully.","Re-run later if AI subtitles are still being generated."],"exampleFix":"// before\nawait run('bilibili subtitle', { url });\n// after\ntry {\n  await run('bilibili subtitle', { url });\n} catch (e) {\n  if (e instanceof EmptyResultError) return [];\n  throw e;\n}","handlingStrategy":"fallback","validationCode":"// No pre-call check; optionally verify the track shows lines in the web player first.","typeGuard":null,"tryCatchPattern":"try {\n  const cues = await run('bilibili subtitle', { url, lang });\n} catch (e) {\n  if (e.name === 'EmptyResultError') {\n    const alt = await run('bilibili subtitle', { url }).catch(() => null); // try default track\n    return alt ?? [];\n  }\n  throw e;\n}","preventionTips":["Try alternate --lang tracks before concluding no subtitles exist.","Re-run later for videos where AI subtitles are still generating.","Handle EmptyResultError as empty data in pipelines.","Prefer videos known to have CC tracks for automated workflows."],"tags":["bilibili","subtitle","empty-result"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}