{"record":{"id":"552d1b56b8339ac9","repo":"ruvnet/ruflo","slug":"roomid-exceeds-128-chars","errorCode":null,"errorMessage":"roomId exceeds 128 chars","messagePattern":"roomId exceeds 128 chars","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/mcp-tools/agentbbs-tools.ts","lineNumber":81,"sourceCode":"    : '.agentbbs';\n  if (/\\.\\.[\\\\/]|\\0/.test(p)) throw new Error('basePath contains disallowed characters');\n  const abs = isAbsolute(p) ? p : resolve(getProjectCwd(), p);\n  return abs;\n}\n\nfunction validateRoomLabel(label: string): string {\n  if (!label || typeof label !== 'string') throw new Error('roomLabel is required');\n  if (label.length > 128) throw new Error('roomLabel exceeds 128 chars');\n  // Rooms are conventionally `#sales`, `#finance`, etc. — keep `#` in the allow-list.\n  if (!/^[A-Za-z0-9_.\\-:/@#]+$/.test(label)) {\n    throw new Error('roomLabel may only contain [A-Za-z0-9_.\\\\-:/@#]');\n  }\n  return label;\n}\n\nfunction validateRoomId(roomId: string): string {\n  if (!roomId || typeof roomId !== 'string') throw new Error('roomId is required');\n  if (roomId.length > 128) throw new Error('roomId exceeds 128 chars');\n  if (!/^[A-Za-z0-9_.\\-:/@#]+$/.test(roomId)) {\n    throw new Error('roomId may only contain [A-Za-z0-9_.\\\\-:/@#]');\n  }\n  return roomId;\n}\n\nfunction ensureDir(dir: string): void {\n  if (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n}\n\nfunction roomIdFromLabel(label: string): string {\n  // Stable, deterministic roomId — strip leading `#`, lowercase, and append a\n  // short hash so we don't collide across two rooms with the same canonical\n  // label but different policies. Phase 1: deterministic over (label).\n  const norm = label.replace(/^#/, '').toLowerCase();\n  const h = createHash('sha256').update(`agentbbs:room:${norm}`).digest('hex').slice(0, 8);\n  return `${norm}-${h}`;\n}","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/mcp-tools/agentbbs-tools.ts#L63-L99","documentation":"validateRoomId() caps roomId at 128 characters, mirroring the roomLabel cap. Derived ids (canonicalized label + short hash suffix from roomIdFromLabel) stay well under the cap, so hitting this limit almost always means a hand-constructed or externally generated id was passed instead of one produced by the tool.","triggerScenarios":"Passing a UUID-plus-path composite, a base64 blob, or a whole label string unhashèd as roomId; generating ids with a scheme that concatenates many segments; copy-paste errors that paste a message envelope id instead of a room id.","commonSituations":"Custom integrations minting their own room ids instead of using the tool-returned ones; log/artifact parsers extracting the wrong field as the id.","solutions":["Use the roomId returned by agentbbs create/resolve calls rather than fabricating one","If you must construct ids, derive them the same way: canonical label + short hash, well under 128 chars","Add a length assertion in your calling code so overlong ids fail with your context, not deep inside the tool"],"exampleFix":"// before — hand-built id exceeds the cap\nawait callMCPTool('agentbbs_read', { roomId: `${tenant}-${project}-${fullPath}-${uuid}` });\n\n// after — use the tool-derived id\nawait callMCPTool('agentbbs_read', { roomId: room.roomId });","handlingStrategy":"validation","validationCode":"if (typeof id !== 'string' || id.length === 0 || id.length > 128) {\n  throw new Error('roomId must be 1-128 characters');\n}","typeGuard":"const isValidRoomIdLength = (v: string): boolean => v.length > 0 && v.length <= 128;","tryCatchPattern":null,"preventionTips":["Tool-derived ids are always short — an overlong id means you built it yourself","Hash or truncate external identifiers before mapping them to roomIds","Assert id length in integration code so failures carry your context"],"tags":["validation","agentbbs","length-limit","rooms"],"backgroundTag":"parameter-length-limit","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}