jackwener/OpenCLI · error · CommandExecutionError

Youdao note parser found note content but extracted no reada

Error message

Youdao note parser found note content but extracted no readable text

What it means

When the page store reports a nonzero raw content length (data[8]) but the extractor produced no readable text in `content`, normalization throws. This catches the case where content exists but the HTML-to-text extraction silently yielded nothing.

Source

Thrown at clis/youdao/note.js:204

    throw new CommandExecutionError(`Youdao note parser failed: ${reason}`);
  }
  const title = String(data[1] ?? '');
  const content = String(data[2] ?? '');
  const summary = String(data[3] ?? '');
  const keywords = String(data[4] ?? '');
  const createTime = data[5];
  const fileSize = data[6];
  const hasContentField = data[7] === true;
  const rawContentLength = Number(data[8] ?? 0);
  const finalUrl = String(data[9] || sourceUrl);
  if (!title) {
    throw new CommandExecutionError('Youdao note parser did not extract a title');
  }
  if (!hasContentField) {
    throw new CommandExecutionError('Youdao note parser did not find full note content in the page store');
  }
  if (rawContentLength > 0 && !content) {
    throw new CommandExecutionError('Youdao note parser found note content but extracted no readable text');
  }
  const row = {};
  row.title = title;
  row.content = content;
  row.summary = summary;
  row.keywords = keywords;
  row.created_at = formatYoudaoTimestamp(createTime);
  row.file_size = fileSize == null ? '' : String(fileSize);
  row.url = finalUrl;
  return row;
}

var command = cli({
  site: 'youdao',
  name: 'note',
  access: 'read',
  description: 'Read a public shared Youdao Note',
  domain: 'share.note.youdao.com',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Inspect the raw content in the page store and extend the text-extraction logic to handle its markup
  2. Add a fallback that decodes/uses the raw content when readable text is empty
  3. Open the note in a browser to confirm it actually has readable text
  4. Update buildExtractorJs for current Youdao editor DOM structure

Example fix

// before
if (!content) throw new CommandExecutionError('...no readable text');
// after
if (!content && rawContentLength > 0) content = stripHtmlTags(rawContent) || '(note contains no extractable text)';
Defensive patterns

Strategy: type-guard

Validate before calling

if (Number(payload?.rawContentLength ?? 0) > 0 && (!payload || !payload.content || payload.content.trim() === '')) {
  throw new Error('Content exists in store but text extraction produced nothing');
}

Type guard

function hasReadableContent(p) {
  return typeof p?.content === 'string' && p.content.trim().length > 0;
}

Try / catch

try {
  await cli.youdao.note({ url });
} catch (e) {
  if (/extracted no readable text/.test(e.message)) {
    console.warn('Note likely contains only images/attachments; export manually if needed');
  } else throw e;
}

Prevention

When it happens

Trigger: rawContentLength > 0 while the content-extraction step returned an empty string — e.g. content stored as markup the text extractor doesn't handle (all images/embeds), a regex/DOM walk that strips everything, or an encoding mismatch.

Common situations: Notes composed only of images or attachments; Youdao changing the editor markup so the text walker finds no text nodes; malformed/legacy note formats.

Related errors


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