jackwener/OpenCLI · error · CommandExecutionError

Manus whoami failed: ${probe.detail}

Error message

Manus whoami failed: ${probe.detail}

What it means

The in-page probe wraps its fetch of /api/auth/session in try/catch; any JavaScript exception (network failure, JSON parse error, CSP/CORS block, fetch undefined) is returned as kind:'exception' and this line rethrows it as CommandExecutionError with the original message in detail.

Source

Thrown at clis/manus/auth.js:37

        return { kind: 'auth', detail: 'Manus /api/auth/session HTTP ' + r.status };
      }
      if (r.status === 503) {
        return { kind: 'http', httpStatus: 503 };
      }
      if (!r.ok) return { kind: 'http', httpStatus: r.status };
      const d = await r.json();
      const u = d?.user || d;
      if (!u || !(u.id || u.userId)) {
        return { kind: 'auth', detail: 'Manus /api/auth/session 200 but no user' };
      }
      return { ok: true, user_id: String(u.id || u.userId), name: String(u.name || u.displayName || '') };
    } catch (e) {
      return { kind: 'exception', detail: String(e && e.message || e) };
    }
  })()`);
  if (probe?.kind === 'auth') throw new AuthRequiredError('manus.im', probe.detail);
  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Manus /api/auth/session`);
  if (probe?.kind === 'exception') throw new CommandExecutionError(`Manus whoami failed: ${probe.detail}`);
  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Manus probe: ${JSON.stringify(probe)}`);
  return { user_id: probe.user_id, name: probe.name };
}

registerSiteAuthCommands({
  site: 'manus',
  domain: 'manus.im',
  loginUrl: 'https://manus.im/login',
  columns: ['user_id', 'name'],
  verify: verifyManusIdentity,
  poll: async (page) => {
    if (!await hasManusSessionCookie(page)) {
      throw new AuthRequiredError('manus.im', 'Waiting for Manus session cookies');
    }
    return verifyManusIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check network connectivity and retry the command.
  2. Open https://manus.im manually to confirm the site loads and the session endpoint works.
  3. Inspect probe.detail in the error message for the underlying exception (e.g. 'Failed to fetch', JSON parse error) and address that cause.
  4. Disable conflicting browser extensions or proxy/SSL interception for manus.im.
  5. Update the CLI if Manus changed /api/auth/session to return non-JSON responses.

Example fix

// before: evaluate loses context on navigation
const probe = await page.evaluate(script); // throws: Execution context destroyed
// after: stabilize before probing
await page.goto('https://manus.im/', { waitUntil: 'domcontentloaded' });
await page.wait(3);
const probe = await page.evaluate(script);
Defensive patterns

Strategy: try-catch

Validate before calling

// verify browser can reach the API before probing
await page.goto('https://manus.im/', { waitUntil: 'domcontentloaded' });
if (!page.url().includes('manus.im')) throw new Error('navigation to manus.im failed');

Type guard

function isProbeException(probe) { return probe?.kind === 'exception'; }

Try / catch

try {
  const identity = await manusWhoami();
} catch (e) {
  if (e.name === 'CommandExecutionError' && e.message.startsWith('Manus whoami failed:')) {
    // detail after colon holds the root cause; log it and retry once after re-navigation
    await page.reload({ waitUntil: 'domcontentloaded' });
  } else throw e;
}

Prevention

When it happens

Trigger: The in-page fetch throws — network interruption, DNS failure, response not JSON (r.json() rejects), page navigating mid-evaluate causing execution-context destruction, a browser extension or CSP blocking fetch.

Common situations: Offline or flaky network while running manus commands; Manus frontend CSP changes blocking in-page fetch; aborted navigation causing evaluate context destruction; API returning HTML (e.g. error page) that fails JSON parsing; SSL/proxy interception errors.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/ad66f697450e5dd9. Report an issue: GitHub.