jackwener/OpenCLI · warning · CliError

NOT_FOUND

NOT_FOUND

Error message

Gitee user "${username}" does not exist

What it means

CliError with code NOT_FOUND thrown when the scraped Gitee profile DOM snapshot reports notFound — the profile page rendered Gitee's 404/not-found state, meaning the username has no Gitee account. The library checks this flag right after normalizing snapshot fields and before calling the user API.

Source

Thrown at clis/gitee/user.js:168

          blocked,
          nickname,
          followers,
          publicRepos,
          giteeIndex,
        };
      })()
    `);
        const domSnapshotRecord = asRecord(rawDomSnapshot);
        const domSnapshot = {
            notFound: domSnapshotRecord?.notFound === true,
            blocked: domSnapshotRecord?.blocked === true,
            nickname: firstText(domSnapshotRecord?.nickname),
            followers: normalizeCount(domSnapshotRecord?.followers),
            publicRepos: normalizeCount(domSnapshotRecord?.publicRepos),
            giteeIndex: normalizeCount(domSnapshotRecord?.giteeIndex),
        };
        if (domSnapshot.notFound) {
            throw new CliError('NOT_FOUND', `Gitee user "${username}" does not exist`, 'Check the username and retry: opencli gitee user <username>');
        }
        if (domSnapshot.blocked) {
            throw new CliError('FORBIDDEN', `Gitee user page "${username}" is not accessible`, 'The profile may be private/restricted, or the account may be unavailable');
        }
        const apiUrl = `${GITEE_USER_API}/${encodeURIComponent(username)}`;
        const apiResponse = await fetch(apiUrl, {
            headers: {
                Accept: 'application/json',
                'User-Agent': 'Mozilla/5.0',
                Referer: profileUrl,
            },
        });
        if (apiResponse.status === 404) {
            throw new CliError('NOT_FOUND', `Gitee user "${username}" does not exist`, 'Check the username and retry: opencli gitee user <username>');
        }
        if (!apiResponse.ok) {
            throw new CliError('REQUEST_FAILED', `Failed to read Gitee user profile API: ${apiResponse.status}`, 'Try again later or verify network access to gitee.com');
        }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the username on gitee.com (e.g. https://gitee.com/<username>) and fix typos
  2. Use the exact login handle, not display name or email
  3. Retry per the hint: opencli gitee user <username> with the corrected value
  4. Handle code NOT_FOUND in scripts to skip missing users instead of aborting a batch

Example fix

// before
opencli gitee user jonh-doe   # NOT_FOUND
// after
opencli gitee user john-doe   # existing handle -> profile fields returned
Defensive patterns

Strategy: try-catch

Validate before calling

// Optional pre-check that the profile exists
const check = await fetch(`https://gitee.com/${encodeURIComponent(username)}`);
if (check.status === 404) {
  console.error(`Gitee user "${username}" does not exist`);
  process.exit(1);
}

Type guard

function isNotFoundCode(e) {
  return e instanceof Error && e.code === 'NOT_FOUND';
}

Try / catch

try {
  profile = await giteeUser(username);
} catch (e) {
  if (e.code === 'NOT_FOUND') {
    console.error(`User "${username}" not found — check the handle and retry`);
    process.exit(1);
  }
  throw e;
}

Prevention

When it happens

Trigger: page.goto(`${GITEE_BASE_URL}/${username}`) loads a profile page whose DOM snapshot contains notFound: true (Gitee 404 page), typically for a nonexistent or deleted account, or a mistyped/har-to-sanitize username.

Common situations: Typos in the username; account deleted or renamed; querying an email or display name instead of the login handle; case/underscore variations that don't exist; org namespace mistaken for a user path.

Understand the failure class

Background: NOT_FOUND error code: why tRPC, Harbor, Nacos and other libraries return 404 "not found" errors for resources that may still exist — this error's family across 11 libraries.

Related errors


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