mui/material-ui · error · Error

tries limit reached

Error message

tries limit reached

What it means

waitUntil is a tiny polling helper: it calls test(), returns its result when predicate is true, otherwise sleeps `delay` ms and recurses, decrementing `tries`. When the configured try budget is exhausted (tries-1 === 0) it throws 'tries limit reached' with no diagnostic about what condition failed. Default tries is -1 (unlimited), so this only fires when a caller explicitly passes a finite tries.

Source

Thrown at packages-internal/waterfall/waitUntil.mjs:12

import sleep from './sleep.mjs';

export default async function waitUntil(test, options = {}) {
  const { delay = 5e3, tries = -1 } = options;
  const { predicate, result } = await test();

  if (predicate) {
    return result;
  }

  if (tries - 1 === 0) {
    throw new Error('tries limit reached');
  }

  await sleep(delay);
  return waitUntil(test, { ...options, tries: tries > 0 ? tries - 1 : tries });
}

View on GitHub (pinned to bdc96df2cb)

Solutions

  1. Inspect what waitUntil is polling (the test function) and verify that target actually reaches the expected state manually.
  2. Increase the tries option (or pass tries:-1 for unlimited during interactive debugging) if the target is just slow.
  3. Increase delay if you are hitting rate limits on the polled endpoint.
  4. Fix the predicate logic if it never returns true due to a comparison bug.

Example fix

// before
await waitUntil(async () => ({ predicate: urlUp(deployUrl) }), { tries: 3, delay: 5000 });
// after — debug the predicate, then raise budget
await waitUntil(async () => {
  const ok = await urlUp(deployUrl);
  console.log('urlUp?', ok);
  return { predicate: ok };
}, { tries: 30, delay: 5000 });
Defensive patterns

Strategy: retry

Validate before calling

// Validate the predicate synchronously where possible before polling.
async function probeOnce(test) { return (await test()).predicate; }
// if (await probeOnce(test)) is false and tries is small, raise the budget

Try / catch

try {
  await waitUntil(test, { tries: 30, delay: 5000 });
} catch (e) {
  if (e.message === 'tries limit reached') {
    // log diagnostic and either rethrow or extend the budget
    throw new Error(`waitUntil gave up: condition never became true (${test.toString()})`);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling waitUntil(test, { tries: N }) where test() never returns predicate:true within N attempts; used by the waterfall/deploy scripts to wait on a deploy URL, service health, or build artifact that never becomes available.

Common situations: Deploy/preview URL polling where the deploy failed; waiting on a service that never comes up; tries set too low for slow CI environments; the predicate function has a bug and always returns false.

Related errors


AI-assisted analysis of mui/material-ui@bdc96df2cb (2026-08-12). Data as JSON: /api/errors/0958129e5a0f632b. Report an issue: GitHub.