{"record":{"id":"380a45447ec4c959","repo":"jackwener/OpenCLI","slug":"unexpected-manus-probe-json-stringify-probe","errorCode":null,"errorMessage":"Unexpected Manus probe: ${JSON.stringify(probe)}","messagePattern":"Unexpected Manus probe: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/manus/auth.js","lineNumber":38,"sourceCode":"      }\n      if (r.status === 503) {\n        return { kind: 'http', httpStatus: 503 };\n      }\n      if (!r.ok) return { kind: 'http', httpStatus: r.status };\n      const d = await r.json();\n      const u = d?.user || d;\n      if (!u || !(u.id || u.userId)) {\n        return { kind: 'auth', detail: 'Manus /api/auth/session 200 but no user' };\n      }\n      return { ok: true, user_id: String(u.id || u.userId), name: String(u.name || u.displayName || '') };\n    } catch (e) {\n      return { kind: 'exception', detail: String(e && e.message || e) };\n    }\n  })()`);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('manus.im', probe.detail);\n  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Manus /api/auth/session`);\n  if (probe?.kind === 'exception') throw new CommandExecutionError(`Manus whoami failed: ${probe.detail}`);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Manus probe: ${JSON.stringify(probe)}`);\n  return { user_id: probe.user_id, name: probe.name };\n}\n\nregisterSiteAuthCommands({\n  site: 'manus',\n  domain: 'manus.im',\n  loginUrl: 'https://manus.im/login',\n  columns: ['user_id', 'name'],\n  verify: verifyManusIdentity,\n  poll: async (page) => {\n    if (!await hasManusSessionCookie(page)) {\n      throw new AuthRequiredError('manus.im', 'Waiting for Manus session cookies');\n    }\n    return verifyManusIdentity(page);\n  },\n});\n","sourceCodeStart":20,"sourceCodeEnd":55,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/manus/auth.js#L20-L55","documentation":"verifyManusIdentity probes https://manus.im/api/auth/session in the page context and classifies the result into known kinds ('auth', 'http', 'exception', or a successful ok:true payload). If the probe object is falsy, lacks ok:true, and matches none of the known kinds, the library throws this CommandExecutionError because the session endpoint returned an unrecognized shape it cannot interpret.","triggerScenarios":"The in-page fetch to /api/auth/session resolves with a 2xx status but the parsed JSON doesn't yield a user object with id/userId (which would normally be classified as 'auth'), or the probe value returned by page.evaluate is null/undefined or a malformed object, e.g. the evaluate script itself was intercepted or the API response shape changed.","commonSituations":"Manus changes their /api/auth/session response schema (e.g. nests the user differently or renames id/userId); a browser extension or CSP blocks/rewrites the fetch; the page context returns undefined because evaluate failed silently; bot-detection returns 200 with an HTML or challenge body instead of JSON.","solutions":["Log out and log back in at https://manus.im/login to refresh the session, then retry","Log the raw probe JSON in the error message to inspect the unexpected shape the endpoint returned","Check whether Manus changed the /api/auth/session response schema and update the probe parsing in clis/manus/auth.js","Retry later or from a clean browser profile in case a proxy, VPN, or extension is tampering with responses"],"exampleFix":"// before (probe parsed loosely, may fall through)\nconst d = await r.json();\nconst u = d?.user || d;\nif (!u || !(u.id || u.userId)) {\n  return { kind: 'auth', detail: 'Manus /api/auth/session 200 but no user' };\n}\n// after (handle nested or renamed fields explicitly)\nconst d = await r.json();\nconst u = d?.user || d?.currentUser || d?.session?.user || d;\nconst uid = u?.id ?? u?.userId ?? u?.uid;\nif (!u || !uid) {\n  return { kind: 'auth', detail: 'Manus /api/auth/session 200 but no user' };\n}\nreturn { ok: true, user_id: String(uid), name: String(u.name || u.displayName || '') };","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["auth","session","api-schema","browser-automation"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}