jackwener/OpenCLI · error · CommandExecutionError
CreateList returned a list payload without a list name.
Error message
CreateList returned a list payload without a list name.
What it means
requireCreateListResult validates the JSON payload returned by Twitter's CreateList GraphQL endpoint before the CLI reports success. It throws when the response payload has no usable `name` string (missing, non-string, or whitespace-only). This guards against silently creating a row for a list whose display name Twitter did not echo back.
Source
Thrown at clis/twitter/list-create.js:67
throw new CommandExecutionError(`HTTP ${result.httpStatus} from CreateList: ${snippet}`);
}
if (!result.bodyJson || typeof result.bodyJson !== 'object') {
throw new CommandExecutionError(`CreateList returned malformed JSON payload. Body: ${String(result.bodyText || '').slice(0, 300)}`);
}
const list = result.bodyJson?.data?.list;
if (!list || typeof list !== 'object') {
const errors = result.bodyJson?.errors;
if (Array.isArray(errors) && errors.length > 0) {
throw new CommandExecutionError(`CreateList failed: ${errors[0].message || JSON.stringify(errors[0])}`);
}
throw new CommandExecutionError(`CreateList returned no list payload. Body: ${String(result.bodyText || '').slice(0, 300)}`);
}
const id = String(list.id_str || list.id || '');
if (!/^\d+$/.test(id)) {
throw new CommandExecutionError('CreateList returned a list payload without a numeric list id.');
}
if (typeof list.name !== 'string' || !list.name.trim()) {
throw new CommandExecutionError('CreateList returned a list payload without a list name.');
}
if (list.name.trim() !== expectedName) {
throw new CommandExecutionError(`CreateList returned name ${JSON.stringify(list.name)}, expected ${JSON.stringify(expectedName)}.`);
}
const modeValue = typeof list.mode === 'string' ? list.mode : '';
if (!modeValue) {
throw new CommandExecutionError('CreateList returned a list payload without list mode.');
}
const mode = /private/i.test(modeValue) ? 'private' : 'public';
if (mode !== expectedMode) {
throw new CommandExecutionError(`CreateList returned mode ${mode}, expected ${expectedMode}.`);
}
return { createdList: list, listId: id, listMode: mode };
}
export function buildListCreateRow({ result, name, description, mode }) {
const { createdList, listId, listMode } = requireCreateListResult(result, name, mode);
return {View on GitHub (pinned to 49907e53dc)
Solutions
- Inspect the raw CreateList response JSON to see what shape Twitter actually returned
- Update the payload parsing (or queryId/FEATURES) to match the current GraphQL response schema
- Retry the create; if transient, re-run `twitter list-create`
- Capture and report the full payload in CommandExecutionError for debugging
Example fix
// before const list = result?.data?.create_list; // schema drift yields undefined fields // after const list = result?.data?.create_list ?? result?.data?.list_create ?? result; // handle known schema variants
Defensive patterns
Strategy: validation
Validate before calling
if (!result?.data?.create_list || typeof result.data.create_list.name !== 'string' || !result.data.create_list.name.trim()) {
throw new Error('CreateList payload missing name; refusing to proceed');
} Type guard
function hasListName(list) {
return !!list && typeof list === 'object' && typeof list.name === 'string' && list.name.trim().length > 0;
} Try / catch
try {
const row = buildListCreateRow({ result, name, description, mode });
} catch (e) {
if (e instanceof CommandExecutionError) console.error('CreateList payload invalid:', e.message, JSON.stringify(result));
else throw e;
} Prevention
- Log the raw CreateList response when validation fails
- Pin the queryId/FEATURES and update deliberately when Twitter's schema changes
- Write a fixture test asserting the parser handles the current response shape
When it happens
Trigger: POST to https://x.com/i/api/graphql/<queryId>/CreateList returns 200 but the list object lacks `name` or has name:"" — e.g. API contract drift, a partial/degraded response, or the evaluate() result being a non-shape object.
Common situations: Twitter changes the CreateList response shape; a proxy/auth layer returns an unexpected object; the caller passes a mock/stub payload without name during tests.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- CreateList returned a list payload without list mode.
- Bilibili conclusion API returned malformed model_result JSON
- Bilibili conclusion API returned malformed model_result
- ${label} returned malformed items payload
- returned no success evidence
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/19ae4891d92635c9.
Report an issue: GitHub.