{"record":{"id":"5ad6a45ab2a7f4b8","repo":"jackwener/OpenCLI","slug":"list-name-is-required","errorCode":null,"errorMessage":"List name is required","messagePattern":"List name is required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/twitter/list-create.js","lineNumber":26,"sourceCode":"const DESCRIPTION_MAX = 100;\n\n// Minimal feature set as observed in the real CreateList web request payload.\n// 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) {","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/twitter/list-create.js#L8-L44","documentation":"parseListCreateArgs validates the arguments of `twitter list-create`. The list `name` is required: it is trimmed and, if empty, ArgumentError('List name is required') is thrown with a usage example. X lists require a non-empty name (max 25 chars), so creation cannot proceed without one.","triggerScenarios":"Calling list-create without the positional name argument, or with an empty/whitespace-only name (e.g. opencli twitter list-create \"\" --mode private), so String(kwargs.name||'').trim() is ''.","commonSituations":"Quoting mistakes where the shell drops the argument; a variable holding the name is empty; a script builds the command from a template with a blank name field; passing only --description/--mode and forgetting the positional.","solutions":["Pass the list name as the first positional argument, quoted if it contains spaces: opencli twitter list-create \"My List\".","Check the shell variable or template field that supplies the name is non-empty before invoking.","Remember subsequent constraints: name ≤ 25 chars, description ≤ 100 chars, mode public|private."],"exampleFix":"// before\nopencli twitter list-create --mode private\nArgumentError: List name is required\n// after\nopencli twitter list-create \"My List\" --mode private","handlingStrategy":"validation","validationCode":"const name = String(args[0] || '').trim();\nif (!name) throw new Error('Usage: opencli twitter list-create \"My List\" [--mode public|private] [--description \"...\"]');","typeGuard":null,"tryCatchPattern":"try {\n  await createList(argv);\n} catch (e) {\n  if (e instanceof ArgumentError && /List name is required/.test(e.message)) {\n    console.error(e.message); // includes usage example\n    process.exitCode = 2;\n    return;\n  }\n  throw e;\n}","preventionTips":["Always quote the positional name so the shell doesn't drop it.","Check the template/variable supplying the name is non-empty before invoking.","Keep names ≤ 25 chars and descriptions ≤ 100 chars to pass the follow-on checks."],"tags":["argument-validation","cli","input"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}