{"record":{"id":"a1750e157763e9bd","repo":"openclaw/openclaw","slug":"dialog-dialogid-is-not-pending","errorCode":null,"errorMessage":"Dialog \"${dialogId}\" is not pending.","messagePattern":"Dialog \"(.+?)\" is not pending\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"extensions/browser/src/browser/pw-session-dialogs.ts","lineNumber":158,"sourceCode":"    return;\n  }\n  if (armed) {\n    clearArmedDialogResponse(pageState);\n  }\n  abortActionsBlockedByDialog(pageState);\n}\n\nexport function resolvePendingDialogForResponse(params: {\n  state: PageState;\n  dialogId?: string;\n}): PendingObservedDialog {\n  const dialogId = normalizeOptionalString(params.dialogId);\n  if (dialogId) {\n    const found = params.state.pendingDialogs.find((dialog) => dialog.id === dialogId);\n    if (found) {\n      return found;\n    }\n    throw new Error(`Dialog \"${dialogId}\" is not pending.`);\n  }\n  if (params.state.pendingDialogs.length === 1) {\n    return expectDefined(params.state.pendingDialogs.at(0), \"single pending browser dialog\");\n  }\n  if (params.state.pendingDialogs.length > 1) {\n    throw new Error(\"Multiple dialogs are pending; pass dialogId.\");\n  }\n  throw new Error(\"No dialog is pending.\");\n}\n\n/** Respond to a pending observed dialog on a page. */\n","sourceCodeStart":140,"sourceCodeEnd":170,"githubUrl":"https://github.com/openclaw/openclaw/blob/01804a75319da4b69c9ab98ceaa30477e22b8c0b/extensions/browser/src/browser/pw-session-dialogs.ts#L140-L170","documentation":"Thrown by resolvePendingDialogForResponse (extensions/browser/src/browser/pw-session-dialogs.ts:158). The caller supplied a dialogId, but no entry in state.pendingDialogs has a matching id. The targeted dialog was already responded to, was auto-dismissed (e.g. by navigation or armed response expiry), or the id is simply wrong.","triggerScenarios":"Responding to a dialog with a dialogId captured from an older snapshot; calling respond twice for the same dialog; the page dismissed the dialog (navigation, armed response fired, or it was a transient alert) between snapshot and response; typo'd dialogId.","commonSituations":"Race between an armed dialog response (armedDialogResponse) auto-settling and an explicit respond call; concurrent respond attempts; snapshot taken before the dialog was promoted into pendingDialogs.","solutions":["Re-snapshot page state and read the current pendingDialogs; respond with a live dialogId.","If exactly one dialog is pending, omit dialogId and let the resolver pick it.","Treat 'not pending' as a no-op success if the dialog was already handled."],"exampleFix":"// before: stale dialogId\nawait respondDialog({ dialogId: oldId, accept: true });\n\n// after: pick a live dialog\nconst { pendingDialogs } = await snapshot(state);\nif (pendingDialogs.length === 1) {\n  await respondDialog({ accept: true }); // omit dialogId\n} else if (pendingDialogs.length) {\n  await respondDialog({ dialogId: pendingDialogs[0].id, accept: true });\n}","handlingStrategy":"validation","validationCode":"// Before responding, confirm the dialogId is still pending.\nconst { pendingDialogs } = await snapshotPageState(page);\nif (dialogId && !pendingDialogs.some((d) => d.id === dialogId)) {\n  // dialog already gone; treat as no-op instead of erroring\n  return { ok: true, alreadyClosed: true };\n}\nawait respondDialog({ dialogId, accept });","typeGuard":"function isPendingDialogId(state, id): boolean {\n  return typeof id === \"string\" && state.pendingDialogs.some((d) => d.id === id);\n}","tryCatchPattern":"try {\n  await respondDialog({ dialogId, accept: true });\n} catch (err) {\n  if (err.message === `Dialog \"${dialogId}\" is not pending.`) {\n    // already handled or dismissed; safe to continue\n    return;\n  }\n  throw err;\n}","preventionTips":["Re-snapshot page state before responding to capture the live pendingDialogs list.","Omit dialogId when exactly one dialog is pending to avoid id drift.","Treat 'not pending' as a no-op when the dialog was already handled."],"tags":["browser","dialog","stale-state","validation"],"backgroundTag":null,"analyzedSha":"01804a75319da4b69c9ab98ceaa30477e22b8c0b","analyzedAt":"2026-08-12T04:37:58.197Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}