{"record":{"id":"cfe1f1f63802c2a1","repo":"jackwener/OpenCLI","slug":"description-must-be-at-most-500-characters","errorCode":null,"errorMessage":"--description must be at most 500 characters","messagePattern":"--description must be at most 500 characters","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/slock/channel-create.js","lineNumber":32,"sourceCode":"  access: 'write',\n  description: 'Create a channel — admin only (POST /channels/). Public unless --private.',\n  domain: SLOCK_DOMAIN,\n  strategy: Strategy.COOKIE,\n  browser: true,\n  siteSession: 'persistent',\n  args: [\n    { name: 'name', positional: true, required: true, help: 'Channel name' },\n    { name: 'description', help: 'Channel description / topic (≤500 chars)' },\n    { name: 'private', type: 'bool', default: false, help: 'Create a private channel instead of public' },\n    { name: 'server', help: 'Override active server' },\n  ],\n  columns: ['id', 'name', 'type', 'result'],\n  func: async (page, kwargs) => {\n    const name = String(kwargs.name ?? '').trim();\n    if (!name) throw new ArgumentError('name required');\n    const description = kwargs.description !== undefined ? String(kwargs.description) : undefined;\n    if (description !== undefined && description.length > 500) {\n      throw new ArgumentError('--description must be at most 500 characters');\n    }\n    const body = { name, visibility: kwargs.private ? 'private' : 'public' };\n    if (description !== undefined) body.description = description;\n    await page.goto(SLOCK_HOME_URL);\n    const snippet = buildFetchSnippet({\n      method: 'POST',\n      path: '/channels/',\n      body,\n      serverScoped: true,\n      serverIdOverride: kwargs.server,\n    });\n    const result = await page.evaluate(`(async () => { ${snippet} })()`);\n    const data = dispatchEvaluateResult(result);\n    return [{ id: data?.id ?? '', name: data?.name ?? name, type: data?.type ?? '', result: 'created' }];\n  },\n});\n","sourceCodeStart":14,"sourceCodeEnd":49,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/channel-create.js#L14-L49","documentation":"`channel-create` enforces Slock's 500-character limit on the channel description. The CLI validates the trimmed string length client-side and throws ArgumentError before issuing the create request, avoiding a doomed API call.","triggerScenarios":"Running `slock channel-create --name x --description \"...\"` where the description string exceeds 500 characters.","commonSituations":"Pasting a long document/README excerpt as the description, or generating descriptions from templates that don't truncate. Also happens when CI passes a multi-line team policy text.","solutions":["Shorten the description to 500 characters or fewer","Truncate programmatically before passing: `--description \"$(echo \"$DESC\" | head -c 500)\"`","Move long content into the channel topic or a linked doc and keep the description brief"],"exampleFix":"// before\n$ slock channel-create --name ops --description \"$(cat long-policy.md)\"  # 4200 chars\nError: --description must be at most 500 characters\n// after\n$ slock channel-create --name ops --description \"$(head -c 500 long-policy.md)\"","handlingStrategy":"validation","validationCode":"const description = String(input.description ?? '');\nif (description.length > 500) {\n  throw new Error(`description is ${description.length} chars; must be <= 500`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await run(['slock', 'channel-create', '--name', name, '--description', description]);\n} catch (e) {\n  if (e instanceof ArgumentError && /at most 500 characters/.test(e.message)) {\n    description = description.slice(0, 500);\n    await run(['slock', 'channel-create', '--name', name, '--description', description]);\n  } else throw e;\n}","preventionTips":["Truncate descriptions to 500 chars at the point of input","Keep long content in a linked doc instead of the description","Add a length check in CI wrappers that build channel descriptions"],"tags":["argument-error","cli","validation","input-length"],"backgroundTag":"input-validation-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}