{"record":{"id":"b63cc2f95d8f916d","repo":"microsoft/playwright","slug":"name-expected-one-of-load-domcontentloaded-ne-b63cc2","errorCode":null,"errorMessage":"${name}: expected one of (load|domcontentloaded|networkidle|commit)","messagePattern":"(.+?): expected one of \\(load\\|domcontentloaded\\|networkidle\\|commit\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/frames.ts","lineNumber":1940,"sourceCode":"    });\n  }\n\n  retain() {\n    ++this._protectCount;\n  }\n\n  release() {\n    --this._protectCount;\n    if (!this._protectCount)\n      this._promise.resolve();\n  }\n}\n\nfunction verifyLifecycle(name: string, waitUntil: types.LifecycleEvent): types.LifecycleEvent {\n  if (waitUntil as unknown === 'networkidle0')\n    waitUntil = 'networkidle';\n  if (!types.kLifecycleEvents.has(waitUntil))\n    throw new Error(`${name}: expected one of (load|domcontentloaded|networkidle|commit)`);\n  return waitUntil;\n}\n\nfunction renderUnexpectedValue(expression: string, received: any): string {\n  if (expression === 'to.match.aria')\n    return received ? received.raw : received;\n  return received;\n}\n","sourceCodeStart":1922,"sourceCodeEnd":1949,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/frames.ts#L1922-L1949","documentation":"Thrown by the verifyLifecycle() helper when a lifecycle event string is not one of the four valid values. The valid set is defined in types.kLifecycleEvents as { 'load', 'domcontentloaded', 'networkidle', 'commit' }. The function also maps 'networkidle0' (Puppeteer-compatible) to 'networkidle' before validation.","triggerScenarios":"Passing an invalid waitUntil value to page.goto(), page.waitForLoadState(), page.setContent(), page.reload(), or frame.goto(). Examples include typos like 'domContentLoaded' (wrong case), 'network Idle', 'loaded', or values from other tools like 'interactive' or 'complete'.","commonSituations":"Typo in the waitUntil option string. Using document.readyState values ('interactive', 'complete') which are NOT valid Playwright lifecycle events. Migrating from Puppeteer and using 'load2' or other non-standard values. Passing a variable that has an undefined or wrong value.","solutions":["Use one of the four valid lifecycle events: 'load', 'domcontentloaded', 'networkidle', or 'commit'.","If migrating from Puppeteer, note that 'networkidle0' is accepted (mapped automatically), but 'domcontentloaded' uses lowercase 'd'.","Define lifecycle events as constants or use TypeScript's LiteralString union types to prevent typos."],"exampleFix":"// before\nawait page.goto(url, { waitUntil: 'DOMContentLoaded' }); // wrong case\n\n// after\nawait page.goto(url, { waitUntil: 'domcontentloaded' });","handlingStrategy":"validation","validationCode":"const VALID_LIFECYCLE = new Set(['load', 'domcontentloaded', 'networkidle', 'commit']);\nfunction validateLifecycle(event) {\n  if (!VALID_LIFECYCLE.has(event))\n    throw new Error(`Invalid lifecycle: ${event}. Use one of: load, domcontentloaded, networkidle, commit`);\n}","typeGuard":"function isLifecycleEvent(value: string): value is 'load' | 'domcontentloaded' | 'networkidle' | 'commit' {\n  return ['load', 'domcontentloaded', 'networkidle', 'commit'].includes(value);\n}","tryCatchPattern":null,"preventionTips":["Use the four valid lifecycle event names exactly as specified.","Define lifecycle events as string-literal union types in TypeScript.","Remember 'domcontentloaded' is all lowercase, not 'DOMContentLoaded'."],"tags":["lifecycle","waituntil","validation","navigation","frame"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}