jackwener/OpenCLI · error · ArgumentError
List name too long: ${name.length} chars (max ${NAME_MAX})
Error message
List name too long: ${name.length} chars (max ${NAME_MAX}) What it means
This ArgumentError is thrown by parseListCreateArgs in clis/twitter/list-create.js when the supplied list name exceeds NAME_MAX = 25 characters (after trimming). Twitter/X enforces a 25-char limit on list names, so the CLI validates it client-side to avoid a guaranteed API rejection. The message includes the actual length and the maximum.
Source
Thrown at clis/twitter/list-create.js:29
// Twitter rejects requests with extra/unknown features (DecodeException).
const FEATURES = {
profile_label_improvements_pcf_label_in_post_enabled: true,
responsive_web_profile_redirect_enabled: false,
rweb_tipjar_consumption_enabled: false,
verified_phone_label_enabled: false,
responsive_web_graphql_skip_user_profile_image_extensions_enabled: false,
responsive_web_graphql_timeline_navigation_enabled: true,
};
export function parseListCreateArgs(kwargs) {
const name = String(kwargs.name || '').trim();
const description = String(kwargs.description || '').trim();
const modeRaw = String(kwargs.mode || 'public').trim().toLowerCase();
if (!name) {
throw new ArgumentError('List name is required', 'Example: opencli twitter list-create "My List"');
}
if (name.length > NAME_MAX) {
throw new ArgumentError(`List name too long: ${name.length} chars (max ${NAME_MAX})`);
}
if (description.length > DESCRIPTION_MAX) {
throw new ArgumentError(`Description too long: ${description.length} chars (max ${DESCRIPTION_MAX})`);
}
if (modeRaw !== 'public' && modeRaw !== 'private') {
throw new ArgumentError(`Invalid mode: ${JSON.stringify(kwargs.mode)}. Expected "public" or "private".`);
}
return { listName: name, listDescription: description, listMode: modeRaw, privateFlag: modeRaw === 'private' };
}
function requireCreateListResult(result, expectedName, expectedMode) {
if (!result || typeof result !== 'object') {
throw new CommandExecutionError(`Unexpected result from twitter list-create: ${JSON.stringify(result)}`);
}
if (result.httpStatus === 401 || result.httpStatus === 403) {
throw new AuthRequiredError('x.com', `Twitter CreateList returned HTTP ${result.httpStatus}`);
}
if (!result.ok) {View on GitHub (pinned to 49907e53dc)
Solutions
- Shorten the list name to 25 characters or fewer (after trimming)
- Check length before calling: name.trim().length <= 25
- If a long title is needed, put it in --description (max 100 chars) and use a short name
Example fix
// before opencli twitter list-create "All Important People To Follow This Year" // after opencli twitter list-create "Important People" --description "All important people to follow this year"
Defensive patterns
Strategy: validation
Validate before calling
const name = String(nameArg || '').trim();
if (name.length > 25) {
throw new Error(`List name must be <= 25 chars (got ${name.length})`);
} Type guard
function isValidListName(name) {
return typeof name === 'string' && name.trim().length > 0 && name.trim().length <= 25;
} Try / catch
try {
await opencli.twitter.listCreate({ name, description, mode });
} catch (e) {
if (e instanceof ArgumentError && /name too long/.test(e.message)) {
console.error('Shorten the list name to <= 25 characters.');
} else { throw e; }
} Prevention
- Validate name length at input collection time, not at API call time
- Use the description field (100 chars) for longer text instead of the name
- Enforce a UI/script-side maxlength of 25 on list-name inputs
When it happens
Trigger: Calling `opencli twitter list-create` with a name argument longer than 25 characters, e.g. a long descriptive title like "Q4 Marketing Prospects Shortlist" (30 chars). The name is trimmed first, so only trailing/leading whitespace is discounted.
Common situations: Pasting a long descriptive title as the list name; scripting list creation from a spreadsheet column with unrestricted-length names; assuming Twitter's 100-char description limit applies to names too.
Related errors
- Description too long: ${description.length} chars (max ${DES
- 标题不能超过 30 字
- --${name} is too long (max 60 chars): ${JSON.stringify(raw)}
- --resume-file requires --all
- twitter download requires either <username> or --tweet-url
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/162fb39bc9cc63e4.
Report an issue: GitHub.