RocketChat/Rocket.Chat · warning · Error

Param "${params.name?.key}" is required

Error message

Param "${params.name?.key}" is required

What it means

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.

Source

Thrown at apps/meteor/server/api/v1/channels.ts:1018

	user: { value: string };
	name?: { key: string; value?: string };
	members?: { key: string; value?: string[] };
	customFields?: { key: string; value?: string };
	teams?: { key: string; value?: string[] };
	teamId?: { key: string; value?: string };
}) {
	const teamId = params.teamId?.value;

	const team = teamId && (await Team.getInfoById(teamId));
	if (
		(!teamId && !(await hasPermissionAsync(params.user.value, 'create-c'))) ||
		(teamId && team && !(await hasPermissionAsync(params.user.value, 'create-team-channel', team.roomId)))
	) {
		throw new Error('unauthorized');
	}

	if (!params.name?.value) {
		throw new Error(`Param "${params.name?.key}" is required`);
	}

	if (params.members?.value && !Array.isArray(params.members.value)) {
		throw new Error(`Param "${params.members.key}" must be an array if provided`);
	}

	if (params.customFields?.value && !(typeof params.customFields.value === 'object')) {
		throw new Error(`Param "${params.customFields.key}" must be an object if provided`);
	}

	if (params.teams?.value && !Array.isArray(params.teams.value)) {
		throw new Error(`Param ${params.teams.key} must be an array`);
	}
}

async function createChannel(
	userId: string,
	params: {

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Ensure the request body/query includes a non-empty 'name' param.
  2. Validate the name client-side before submitting the create request.
  3. Check the param key casing matches what the endpoint's ParsedJoin parser expects.

Example fix

// before
if (!params.name?.value) {
  throw new Error(`Param "${params.name?.key}" is required`);
}

// after - guard the key access and validate earlier
if (!params.name || !params.name.value) {
  throw new Meteor.Error('error-param-required', 'The "name" param is required');
}
Defensive patterns

Strategy: validation

Validate before calling

function validateCreateChannelParams(params) {
  if (!params.name || typeof params.name !== 'string' || params.name.trim() === '') {
    throw new Error('The "name" param is required and must be a non-empty string');
  }
}

Type guard

function hasNonEmptyName(params) {
  return typeof params?.name === 'string' && params.name.trim().length > 0;
}

Try / catch

try {
  await api.createChannel(payload);
} catch (e) {
  if (/Param ".*" is required/.test(e.message)) {
    highlightEmptyField('name');
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12). Data as JSON: /api/errors/535065ef625dde51. Report an issue: GitHub.