{"record":{"id":"3e0523ede6f73a89","repo":"diegosouzapw/OmniRoute","slug":"payload-error-message-http-res-status","errorCode":null,"errorMessage":"payload.error?.message ?? `HTTP ${res.status}`","messagePattern":"payload\\.error\\?\\.message \\?\\? `HTTP (.+?)`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/app/(dashboard)/dashboard/tools/agent-bridge/AgentBridgePageClient.tsx","lineNumber":105,"sourceCode":"  });\n\n  const postServerAction = useCallback(\n    async (\n      action: \"start\" | \"stop\" | \"restart\" | \"trust-cert\" | \"regenerate-cert\",\n      sudoPassword?: string\n    ) => {\n      const res = await fetch(\"/api/tools/agent-bridge/server\", {\n        method: \"POST\",\n        headers: { \"Content-Type\": \"application/json\" },\n        body: JSON.stringify(sudoPassword ? { action, sudoPassword } : { action }),\n      });\n      const payload = (await res.json().catch(() => ({}))) as {\n        error?: { message?: string };\n        skippable?: boolean;\n        manualGuide?: CertManualGuide;\n      };\n      if (!res.ok) {\n        throw new Error(payload.error?.message ?? `HTTP ${res.status}`);\n      }\n      if (payload.skippable && payload.manualGuide) {\n        setCertGuide(payload.manualGuide);\n      } else if (action === \"trust-cert\") {\n        setCertGuide(null);\n      }\n      await refresh();\n    },\n    [refresh]\n  );\n\n  // ── Server actions ────────────────────────────────────────────────────────\n\n  const handleServerAction = useCallback(\n    async (action: \"start\" | \"stop\" | \"restart\" | \"trust-cert\" | \"regenerate-cert\") => {\n      setActionError(null);\n      if (action === \"trust-cert\") {\n        await runPrivileged(async (password) => {","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/app/(dashboard)/dashboard/tools/agent-bridge/AgentBridgePageClient.tsx#L87-L123","documentation":"Agent-bridge server action guard: postServerAction() POSTs an action (start/stop/restart/trust-cert/regenerate-cert, optionally with sudoPassword) to /api/tools/agent-bridge/server and on non-ok throws payload.error?.message or the 'HTTP <status>' sentinel. The privileged action did not take effect; the payload may also carry skippable/manualGuide fields describing certificate steps that must be done manually.","triggerScenarios":"Thrown at src/app/(dashboard)/dashboard/tools/agent-bridge/AgentBridgePageClient.tsx:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read payload.error.message — it is the sanitized server-side reason (bad sudo password, process spawn failure)","Follow manualGuide/skippable hints when present for cert actions","Retry the action with corrected credentials or after fixing the service"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}