jackwener/OpenCLI · error · CommandExecutionError

Failed to open Youdao Note URL: ${error instanceof Error ? e

Error message

Failed to open Youdao Note URL: ${error instanceof Error ? error.message : String(error)}

What it means

The command wraps page.goto(url) in try/catch and converts any navigation failure (network error, DNS failure, timeout, invalid URL) into a CommandExecutionError with the underlying message. It means the browser automation could not open the normalized Youdao share URL at all.

Source

Thrown at clis/youdao/note.js:234

var command = cli({
  site: 'youdao',
  name: 'note',
  access: 'read',
  description: 'Read a public shared Youdao Note',
  domain: 'share.note.youdao.com',
  strategy: Strategy.PUBLIC,
  browser: true,
  args: [
    { name: 'url', positional: true, required: true, help: 'Full share URL of the Youdao Note' },
  ],
  columns: ['title', 'content', 'summary', 'keywords', 'created_at', 'file_size', 'url'],
  func: async function(page, kwargs) {
    const url = normalizeShareUrl(kwargs.url);
    try {
      await page.goto(url);
    } catch (error) {
      throw new CommandExecutionError(`Failed to open Youdao Note URL: ${error instanceof Error ? error.message : String(error)}`);
    }
    try {
      await page.wait({ selector: '#root, .file-name, body', timeout: 10 });
    } catch {
      await page.wait(3).catch(function() {});
    }
    await page.wait(2).catch(function() {});
    let payload;
    try {
      payload = await page.evaluate(buildExtractorJs());
    } catch (error) {
      throw new CommandExecutionError(`Youdao note extractor failed: ${error instanceof Error ? error.message : String(error)}`);
    }
    return [normalizeExtractionResult(payload, url)];
  },
});

export var __test__ = {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check network connectivity and that the URL opens in a normal browser
  2. Fix/normalize the share URL passed with --url
  3. Configure proxy settings (HTTP_PROXY/HTTPS_PROXY) if behind a firewall
  4. Retry — transient timeouts often resolve; add retry/backoff around the command

Example fix

// before
await cli youdao note --url 'youdao.com/invalid'
// after
await cli youdao note --url 'https://note.youdao.com/ynoteshare/index.html?id=valid-id'
Defensive patterns

Strategy: try-catch

Validate before calling

const u = new URL(rawUrl);
if (!/youdao\.com$/.test(u.hostname)) throw new Error(`Not a Youdao URL: ${u.href}`);
if (!(await fetch(u.href, { method: 'HEAD' })).ok) throw new Error('Share URL unreachable');

Try / catch

try {
  await cli.youdao.note({ url });
} catch (e) {
  if (/Failed to open Youdao Note URL/.test(e.message)) {
    console.error('Navigation failed:', e.message);
    // check proxy/offline, then retry with backoff
  } else throw e;
}

Prevention

When it happens

Trigger: page.goto throws: DNS resolution failure, TLS error, connection refused/timeout, offline environment, proxy blocking youdao.com, or an invalid URL passed via kwargs.url.

Common situations: Corporate proxy/firewall blocking the domain; no internet access in CI; mistyped share link; Youdao endpoint outage or regional block.

Related errors


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