jackwener/OpenCLI · error · CommandExecutionError
Manus ${label} returned a malformed API payload
Error message
Manus ${label} returned a malformed API payload What it means
CommandExecutionError thrown by requireObject() when, after all known error markers are ruled out, the unwrapped value is still not a plain object. It indicates the Manus endpoint returned something the CLI's contract does not recognize.
Source
Thrown at clis/manus/_utils.js:74
payload.details,
];
return candidates.find((value) => typeof value === 'string' && value.trim())?.trim() || '';
}
export function requireObject(payload, label) {
const value = unwrapEvaluateResult(payload);
if (value?.__authRequired) {
throw new AuthRequiredError(MANUS_DOMAIN, value.message || 'Authentication required — please sign in to Manus in the browser');
}
if (value?.__httpError) {
const message = extractErrorMessage(value);
throw new CommandExecutionError(message ? `Manus ${label} failed (HTTP ${value.__httpError}): ${message}` : `Manus ${label} failed (HTTP ${value.__httpError})`);
}
if (value?.__error) {
throw new CommandExecutionError(`Manus ${label} failed: ${value.message || value.__error}`);
}
if (!value || typeof value !== 'object' || Array.isArray(value)) {
throw new CommandExecutionError(`Manus ${label} returned a malformed API payload`);
}
return value;
}
export function requireArray(value, label) {
if (!Array.isArray(value)) {
throw new CommandExecutionError(`Manus ${label} returned a malformed API payload`);
}
return value;
}
export function requireString(value, label) {
const text = String(value ?? '').trim();
if (!text) {
throw new CommandExecutionError(`Manus ${label} returned a malformed API payload`);
}
return text;
}View on GitHub (pinned to 49907e53dc)
Solutions
- Log the raw payload before requireObject to see the actual value.
- Check for bot-protection/CDN interstitials by opening Manus in the browser.
- Update the CLI to match the new response schema.
- Retry if the page navigated mid-evaluate (transient).
Example fix
// before
const data = await requireObject(payload, 'sessions');
// after
if (payload == null) console.error('raw evaluate result:', payload);
const data = await requireObject(payload, 'sessions'); Defensive patterns
Strategy: type-guard
Validate before calling
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
console.error('unexpected Manus payload:', typeof raw, String(raw).slice(0, 200));
} Type guard
function isPlainObject(v) { return v !== null && typeof v === 'object' && !Array.isArray(v); } Try / catch
try {
const data = await manusData();
} catch (e) {
if (/malformed API payload/.test(e.message)) {
console.error('Unrecognized Manus response — check for bot-protection pages or API changes');
} else throw e;
} Prevention
- Confirm no CDN/bot-protection interstitial when opening manus.com.
- Log raw evaluate results in development before shipping scripts.
- Update the CLI after Manus API releases.
When it happens
Trigger: unwrapEvaluateResult yields null/undefined/array/primitive — e.g. the evaluate returned undefined, a serialized HTML page, or the endpoint's top-level response changed from object to array/string.
Common situations: Manus API response shape change after an update, evaluate result lost due to page navigation, proxy/CDN returning HTML challenge pages (bot protection).
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Maimai search returned malformed API payload
- Maimai search API payload missing talent list
- Bilibili ${label} API returned a malformed payload
- lichess user: Lichess user "${username}" returned empty payl
- LinkedIn Learning searchV2 returned malformed payload: missi
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/5bceb721af2e7338.
Report an issue: GitHub.