jackwener/OpenCLI · warning · CliError

NO_DATA

NO_DATA

Error message

Company ${encCoId} not found

What it means

The 51job company detail CLI fetched the company page in a headless browser, and the in-page script detected the company does not exist (it set data.error='NOT_FOUND'), so the library throws CliError('NO_DATA'). This is a per-page data availability error: the requested encCoId does not resolve to a live company profile on 51job. It is thrown before any parsing is attempted.

Source

Thrown at clis/51job/company.js:82

                    };
                });
            // Company meta is three inline spans under .c-info.ellipsis
            // (title/size/industry) — extract them by position.
            const cInfo = document.querySelector('.c-info.ellipsis');
            const cInfoParts = cInfo
                ? [...cInfo.querySelectorAll('span')].map(s => (s.innerText || '').trim()).filter(Boolean)
                : [];
            return {
                companyName,
                companyIntro,
                links,
                cInfoParts,
                sidebarText: sidebarText.slice(0, 400),
            };
        })()`;
        const data = await page.evaluate(script);
        if (data.error === 'NOT_FOUND') {
            throw new CliError('NO_DATA', `Company ${encCoId} not found`);
        }
        if (!data.companyName) {
            throw new CliError('NO_DATA', `Could not parse company page ${encCoId}; layout may have changed`);
        }

        const companyUrl = url;
        const [companyType = '', companySize = '', companyIndustry = ''] = data.cInfoParts || [];

        const seen = new Set();
        const rows = [];
        for (const link of data.links || []) {
            const job = parseCompanyJobCard(link);
            if (!job) continue;
            if (seen.has(job.jobId)) continue;
            seen.add(job.jobId);
            rows.push({
                rank: rows.length + 1,
                ...job,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the encCoId by opening the company URL in a browser; if 404, the id is invalid — obtain a fresh id from a current job listing
  2. Re-scrape or refresh your source listing to get a live encCoId
  3. Confirm you are passing the encoded id exactly as it appears in the 51job company URL, not a raw numeric id
  4. Retry later in case of a transient site-side outage masquerading as not-found

Example fix

// before
await cli.company({ encCoId: cachedId });
// after
if (!/^[A-Za-z0-9]+$/.test(cachedId)) throw new Error('bad encCoId');
try {
  const info = await cli.company({ encCoId: cachedId });
} catch (e) {
  if (e.code === 'NO_DATA') refreshCompanyCache(cachedId); // drop stale id
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!encCoId || typeof encCoId !== 'string') throw new Error('valid encCoId required');

Type guard

const isEncCoId = (v) => typeof v === 'string' && /^[A-Za-z0-9_-]+$/.test(v);

Try / catch

try {
  const info = await cli.company({ encCoId });
} catch (e) {
  if (e.code === 'NO_DATA') return null; // company does not exist
  throw e;
}

Prevention

When it happens

Trigger: Calling the company subcommand with an encCoId that does not exist on 51job (deleted company, typo in the encoded id, or an id scraped from a stale listing). The in-page script checks for the site's not-found state and returns error='NOT_FOUND', hitting the throw at clis/51job/company.js:82.

Common situations: Re-using company ids cached from an old crawl; ids taken from job postings whose company has since been removed; passing a numeric company id instead of the encoded encCoId the site uses in URLs; site A/B tests moving the not-found marker so the page yields NOT_FOUND incorrectly.

Related errors


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