{"record":{"id":"4ad909aa402f628b","repo":"Mintplex-Labs/anything-llm","slug":"no-pending-help-request-with-that-id","errorCode":null,"errorMessage":"no pending help request with that id","messagePattern":"no pending help request with that id","errorType":"http","errorClass":null,"httpStatus":404,"severity":"warning","filePath":"open-computer/services/interface-service/routes/api.js","lineNumber":441,"sourceCode":"      }\n\n      const responseRpc = workspace.pendingHelp.rpc || workspace.piRpc;\n      if (responseRpc) {\n        responseRpc.write(\n          JSON.stringify({\n            type: \"extension_ui_response\",\n            id: requestId,\n            value: response || \"\",\n          }) + \"\\n\",\n        );\n        workspace.pendingHelp = null;\n        console.log(`[pi] Help response sent: ${response}`);\n        return res.json({ status: \"ok\" });\n      }\n      return res.status(500).json({ error: \"agent not running\" });\n    }\n\n    return res.status(404).json({ error: \"no pending help request with that id\" });\n  });\n\n  // ── Headless root ──────────────────────────────────────────────────────\n\n  app.get(\"/\", (req, res, next) => {\n    if (!HEADLESS) return next();\n    res.json({\n      service: \"interface-service\",\n      agent: AGENT_NAME,\n      status: \"ok\",\n      agent_status: currentAgentStatus(),\n      headless: true,\n      uptime_seconds: Math.floor(process.uptime()),\n      platform: process.platform,\n      arch: process.arch,\n      memory_mb: Math.floor(process.memoryUsage.rss() / 1024 / 1024),\n      port: process.env.PORT || 8080,\n      endpoints: {","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/open-computer/services/interface-service/routes/api.js#L423-L459","documentation":"Returned (HTTP 404) by POST /api/v1/help-response when requestId does not equal workspace.pendingHelp?.id. This is the endpoint's idempotency guard: a successful response sets workspace.pendingHelp = null (api.js:434), so a second submit with the same id no longer matches and 404s. It also fires when no help request is pending at all, or after a session reset (which nulls pendingHelp).","triggerScenarios":"Re-POSTing a help response with a requestId that was already answered (double-click, UI retry, page reload resubmitting the dialog); posting an id captured from an older ask_for_help event; posting after POST /api/v1/session/new cleared pendingHelp; answering from a second browser tab after the first tab already responded.","commonSituations":"Duplicate form submissions without disabling the submit button; two tabs racing to answer the same ask_for_help (first wins, second 404s); reconnect flows replaying stale dialog state after the agent restarted its session.","solutions":["Treat the 404 as 'already answered or dismissed' and refresh the pending-help state instead of retrying blindly","Disable the submit control after the first successful POST so the same requestId is never sent twice","If the agent should re-ask, send a new prompt via /api/v1/prompt rather than replaying the old requestId"],"exampleFix":"// before\nfunction onSubmit(response) {\n  post('/api/v1/help-response', {requestId: this.requestId, response});\n}\n\n// after: single-flight submit + tolerate the already-handled case\nasync onSubmit(response) {\n  if (this.submitting) return;\n  this.submitting = true;\n  try {\n    await post('/api/v1/help-response', {requestId: this.requestId, response});\n  } catch (e) {\n    if (e.status === 404) console.warn('help request already handled');\n    else throw e;\n  } finally {\n    this.submitting = false;\n  }\n}","handlingStrategy":"validation","validationCode":"// Only respond while this requestId is still the active pending request\nconst {pendingHelp} = await getPendingHelp(); // whatever state feed your UI uses\nif (!pendingHelp || pendingHelp.id !== this.requestId) return; // stale dialog — do not POST","typeGuard":null,"tryCatchPattern":"try { await postHelpResponse(requestId, response); }\ncatch (e) {\n  if (e.status === 404) return refreshPendingHelp(); // already answered elsewhere\n  throw e;\n}","preventionTips":["Disable the submit button after the first successful POST (single-flight the dialog)","Key help dialogs by the live pendingHelp id and drop them on session reset","Treat 404 here as success-equivalent (someone answered first), not as an error to surface"],"tags":["help-request","idempotency","http-404","stale-state","interface-service"],"backgroundTag":"stale-request-id","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}