{"record":{"id":"162fb39bc9cc63e4","repo":"jackwener/OpenCLI","slug":"list-name-too-long-name-length-chars-max-na","errorCode":null,"errorMessage":"List name too long: ${name.length} chars (max ${NAME_MAX})","messagePattern":"List name too long: (.+?) chars \\(max (.+?)\\)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/twitter/list-create.js","lineNumber":29,"sourceCode":"// Twitter rejects requests with extra/unknown features (DecodeException).\nconst FEATURES = {\n    profile_label_improvements_pcf_label_in_post_enabled: true,\n    responsive_web_profile_redirect_enabled: false,\n    rweb_tipjar_consumption_enabled: false,\n    verified_phone_label_enabled: false,\n    responsive_web_graphql_skip_user_profile_image_extensions_enabled: false,\n    responsive_web_graphql_timeline_navigation_enabled: true,\n};\n\nexport function parseListCreateArgs(kwargs) {\n    const name = String(kwargs.name || '').trim();\n    const description = String(kwargs.description || '').trim();\n    const modeRaw = String(kwargs.mode || 'public').trim().toLowerCase();\n    if (!name) {\n        throw new ArgumentError('List name is required', 'Example: opencli twitter list-create \"My List\"');\n    }\n    if (name.length > NAME_MAX) {\n        throw new ArgumentError(`List name too long: ${name.length} chars (max ${NAME_MAX})`);\n    }\n    if (description.length > DESCRIPTION_MAX) {\n        throw new ArgumentError(`Description too long: ${description.length} chars (max ${DESCRIPTION_MAX})`);\n    }\n    if (modeRaw !== 'public' && modeRaw !== 'private') {\n        throw new ArgumentError(`Invalid mode: ${JSON.stringify(kwargs.mode)}. Expected \"public\" or \"private\".`);\n    }\n    return { listName: name, listDescription: description, listMode: modeRaw, privateFlag: modeRaw === 'private' };\n}\n\nfunction requireCreateListResult(result, expectedName, expectedMode) {\n    if (!result || typeof result !== 'object') {\n        throw new CommandExecutionError(`Unexpected result from twitter list-create: ${JSON.stringify(result)}`);\n    }\n    if (result.httpStatus === 401 || result.httpStatus === 403) {\n        throw new AuthRequiredError('x.com', `Twitter CreateList returned HTTP ${result.httpStatus}`);\n    }\n    if (!result.ok) {","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/twitter/list-create.js#L11-L47","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nopencli twitter list-create \"All Important People To Follow This Year\"\n// after\nopencli twitter list-create \"Important People\" --description \"All important people to follow this year\"","handlingStrategy":"validation","validationCode":"const name = String(nameArg || '').trim();\nif (name.length > 25) {\n  throw new Error(`List name must be <= 25 chars (got ${name.length})`);\n}","typeGuard":"function isValidListName(name) {\n  return typeof name === 'string' && name.trim().length > 0 && name.trim().length <= 25;\n}","tryCatchPattern":"try {\n  await opencli.twitter.listCreate({ name, description, mode });\n} catch (e) {\n  if (e instanceof ArgumentError && /name too long/.test(e.message)) {\n    console.error('Shorten the list name to <= 25 characters.');\n  } else { throw e; }\n}","preventionTips":["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"],"tags":["argument-validation","input-length","twitter"],"backgroundTag":"input-validation-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}