jackwener/OpenCLI · error · CliError

PARSE_ERROR

PARSE_ERROR

Error message

PARSE_ERROR

What it means

The episode payload exists but contains no usable transcript media identifier. The CLI probes `episode.transcript.mediaId`, `episode.media.id`, and `episode.transcriptMediaId`; if all are missing/empty it throws CliError PARSE_ERROR listing the expected locations, since /v1/episode-transcript/get cannot be called without a mediaId.

Source

Thrown at clis/xiaoyuzhou/transcript.js:38

    ],
    columns: ['title', 'podcast', 'status', 'segments', 'json_file', 'text_file'],
    func: async (kwargs) => {
        if (kwargs.json === false && kwargs.text === false) {
            throw new ArgumentError('At least one of --json or --text must be enabled', 'Example: opencli xiaoyuzhou transcript 69dd0c98e2c8be31551f6a33 --text true');
        }
        let credentials = loadXiaoyuzhouCredentials();
        const episodeResponse = await requestXiaoyuzhouJson('/v1/episode/get', {
            query: { eid: kwargs.id },
            credentials,
        });
        credentials = episodeResponse.credentials;
        const episode = episodeResponse.data;
        if (!episode) {
            throw new CliError('NOT_FOUND', 'Episode not found', 'Please check the episode ID');
        }
        const mediaId = String(episode.transcript?.mediaId || episode.media?.id || episode.transcriptMediaId || '').trim();
        if (!mediaId) {
            throw new CliError('PARSE_ERROR', 'mediaId not found in episode payload', 'Transcript metadata requires episode.transcript.mediaId, episode.media.id, or episode.transcriptMediaId');
        }
        const transcriptResponse = await requestXiaoyuzhouJson('/v1/episode-transcript/get', {
            method: 'POST',
            body: {
                eid: kwargs.id,
                mediaId,
            },
            credentials,
        });
        const transcriptMeta = transcriptResponse.data;
        const transcriptUrl = String(transcriptMeta?.transcriptUrl || transcriptMeta?.url || '').trim();
        if (!transcriptUrl) {
            throw new CliError('EMPTY_RESULT', 'Transcript URL not found', 'This episode may not have transcript data available');
        }
        const transcriptBody = await fetchXiaoyuzhouTranscriptBody(transcriptUrl);
        const { text, segmentCount } = extractTranscriptText(transcriptBody);
        if (kwargs.text !== false && transcriptBody.trim() && !text.trim()) {
            throw new CliError('PARSE_ERROR', 'Failed to extract transcript text', 'Transcript payload format is unsupported. Re-run with --json true to inspect the raw payload.');

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Confirm the episode actually has a transcript in the xiaoyuzhou app
  2. Re-run after CLI update in case the schema extraction was fixed
  3. Re-authenticate to rule out redacted payloads from bad credentials
  4. If it's an old episode without transcripts, transcript retrieval is not possible for that eid
Defensive patterns

Strategy: type-guard

Validate before calling

const ep = episodeResponse?.data;
const mediaId = String(ep?.transcript?.mediaId || ep?.media?.id || ep?.transcriptMediaId || '').trim();
if (!mediaId) throw new Error('Episode has no transcript mediaId');

Type guard

const hasMediaId = (ep) => Boolean(ep && (ep.transcript?.mediaId || ep.media?.id || ep.transcriptMediaId));

Try / catch

try { await transcript(eid); } catch (e) { if (String(e).includes('mediaId not found')) { console.error('Episode lacks transcript metadata; skipping'); return null; } throw e; }

Prevention

When it happens

Trigger: The episode has no transcript attached (mediaId absent in all three fallback fields), the API schema renamed these fields, or the episode payload is a partial/preview object without transcript metadata.

Common situations: Episodes published before the transcript feature, non-podcast audio items without transcripts, xiaoyuzhou schema changes after an app update, or fetching with reduced-auth tokens that receive redacted payloads.

Understand the failure class

Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/0fad6034e09fb9b8. Report an issue: GitHub.