naptha/tesseract.js · info

`load` is depreciated and should be removed from code (worke

Error message

`load` is depreciated and should be removed from code (workers now come pre-loaded)

What it means

worker.load() previously triggered loading of the WASM core and language data. In current versions, createWorker auto-runs loadInternal() (src/createWorker.js:239) during construction, so workers arrive ready. The load() method is retained only for backward compatibility and now just emits console.warn with no functional effect.

Source

Thrown at src/createWorker.js:67

  workerCounter += 1;

  const startJob = ({ id: jobId, action, payload }) => (
    new Promise((resolve, reject) => {
      log(`[${id}]: Start ${jobId}, action=${action}`);
      // Using both `action` and `jobId` in case user provides non-unique `jobId`.
      const promiseId = `${action}-${jobId}`;
      promises[promiseId] = { resolve, reject };
      send(worker, {
        workerId: id,
        jobId,
        action,
        payload,
      });
    })
  );

  const load = () => (
    console.warn('`load` is depreciated and should be removed from code (workers now come pre-loaded)')
  );

  const loadInternal = (jobId) => (
    startJob(createJob({
      id: jobId, action: 'load', payload: { options: { lstmOnly: lstmOnlyCore, corePath: options.corePath, logging: options.logging } },
    }))
  );

  const writeText = (path, text, jobId) => (
    startJob(createJob({
      id: jobId,
      action: 'FS',
      payload: { method: 'writeFile', args: [path, text] },
    }))
  );

  const readText = (path, jobId) => (
    startJob(createJob({

View on GitHub (pinned to a1ca80d9e3)

Solutions

  1. Delete the worker.load() call — the worker is ready as soon as createWorker(...) resolves.
  2. If keeping it temporarily to avoid breaking flows, note it is a no-op and schedule removal.
  3. Update documentation/examples in your codebase to the v4/v5 pattern.

Example fix

// before
const worker = await createWorker('eng');
await worker.load(); // deprecated, prints warning
await worker.recognize(img);

// after
const worker = await createWorker('eng');
await worker.recognize(img);
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Calling await worker.load() in user code. The call resolves instantly after printing the warning and changes nothing.

Common situations: Copy-pasting examples from Tesseract.js v2 tutorials or older docs; migrating from an earlier API where load() was required; IDE autocomplete suggesting load().


AI-assisted analysis of naptha/tesseract.js@a1ca80d9e3 (2026-08-13). Data as JSON: /api/errors/885c5f04af043c13. Report an issue: GitHub.