{"record":{"id":"535065ef625dde51","repo":"RocketChat/Rocket.Chat","slug":"param-params-name-key-is-required","errorCode":null,"errorMessage":"Param \"${params.name?.key}\" is required","messagePattern":"Param \"(.+?)\" is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/meteor/server/api/v1/channels.ts","lineNumber":1018,"sourceCode":"\tuser: { value: string };\n\tname?: { key: string; value?: string };\n\tmembers?: { key: string; value?: string[] };\n\tcustomFields?: { key: string; value?: string };\n\tteams?: { key: string; value?: string[] };\n\tteamId?: { key: string; value?: string };\n}) {\n\tconst teamId = params.teamId?.value;\n\n\tconst team = teamId && (await Team.getInfoById(teamId));\n\tif (\n\t\t(!teamId && !(await hasPermissionAsync(params.user.value, 'create-c'))) ||\n\t\t(teamId && team && !(await hasPermissionAsync(params.user.value, 'create-team-channel', team.roomId)))\n\t) {\n\t\tthrow new Error('unauthorized');\n\t}\n\n\tif (!params.name?.value) {\n\t\tthrow new Error(`Param \"${params.name?.key}\" is required`);\n\t}\n\n\tif (params.members?.value && !Array.isArray(params.members.value)) {\n\t\tthrow new Error(`Param \"${params.members.key}\" must be an array if provided`);\n\t}\n\n\tif (params.customFields?.value && !(typeof params.customFields.value === 'object')) {\n\t\tthrow new Error(`Param \"${params.customFields.key}\" must be an object if provided`);\n\t}\n\n\tif (params.teams?.value && !Array.isArray(params.teams.value)) {\n\t\tthrow new Error(`Param ${params.teams.key} must be an array`);\n\t}\n}\n\nasync function createChannel(\n\tuserId: string,\n\tparams: {","sourceCodeStart":1000,"sourceCodeEnd":1036,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/server/api/v1/channels.ts#L1000-L1036","documentation":"Thrown during channel creation when params.name.value is falsy after the permission check passes. The key (the actual request param name, e.g. 'name') is interpolated. Note params.name?.key is used - if params.name itself is undefined this throws with an empty/undefined key, indicating the param was not parsed at all.","triggerScenarios":"Calling the create-channel endpoint without a 'name' field, with an empty string name, or with a name param that the AJV/query parser did not bind into params.name.","commonSituations":"Client form submitting an empty name field; integration test missing the name property; param casing mismatch (Name vs name) causing the parser to skip it.","solutions":["Ensure the request body/query includes a non-empty 'name' param.","Validate the name client-side before submitting the create request.","Check the param key casing matches what the endpoint's ParsedJoin parser expects."],"exampleFix":"// before\nif (!params.name?.value) {\n  throw new Error(`Param \"${params.name?.key}\" is required`);\n}\n\n// after - guard the key access and validate earlier\nif (!params.name || !params.name.value) {\n  throw new Meteor.Error('error-param-required', 'The \"name\" param is required');\n}","handlingStrategy":"validation","validationCode":"function validateCreateChannelParams(params) {\n  if (!params.name || typeof params.name !== 'string' || params.name.trim() === '') {\n    throw new Error('The \"name\" param is required and must be a non-empty string');\n  }\n}","typeGuard":"function hasNonEmptyName(params) {\n  return typeof params?.name === 'string' && params.name.trim().length > 0;\n}","tryCatchPattern":"try {\n  await api.createChannel(payload);\n} catch (e) {\n  if (/Param \".*\" is required/.test(e.message)) {\n    highlightEmptyField('name');\n    return;\n  }\n  throw e;\n}","preventionTips":["Validate name is a non-empty string client-side before submit.","Match the exact param key casing the endpoint expects.","Disable the submit button until name is filled."],"tags":["channels","validation","required-param","create"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}