RocketChat/Rocket.Chat · error · Error

Param " " is required

Error message

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

What it means

Validation error from POST channels.create: the name parameter is missing, empty, or undefined. validateChannelParams checks params.name?.value before creating anything, so an absent or blank channel name fails fast with a 400-class error.

Solutions

  1. Ensure the request body includes a non-empty 'name' field (required) at the top level of the JSON
  2. Trim and validate the name client-side before sending; disable submit until filled
  3. Check for typos in the payload key — it must be exactly 'name'

Example fix

// before
POST /api/v1/channels.create { "channelName": "dev-talk" }

// after
POST /api/v1/channels.create { "name": "dev-talk" }
Defensive patterns

Strategy: validation

Validate before calling

const name = (body.name ?? '').toString().trim();
if (!name) throw new Error('channels.create: name is required');

Type guard

const hasChannelName = (b: { name?: unknown }): b is { name: string } =>
  typeof b.name === 'string' && b.name.trim().length > 0;

Try / catch

try { await POST('/api/v1/channels.create', body); } catch (e) {
  if (/is required/.test(e.message)) { /* highlight the name field */ }
}

Prevention

When it happens

Trigger: POST /api/v1/channels.create where the JSON body omits 'name', sends name: '' or name: null, or a bug in the caller sends the name under a different key (e.g. 'channelName').

Common situations: Form submitted before the user typed a name; whitespace-only or empty-string name from a template; key mismatch after refactoring client code; scripts building bodies dynamically where name resolves to undefined.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

	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 e4b8178b20)