RocketChat/Rocket.Chat · error · Meteor.Error

error-name-param-not-provided

error-name-param-not-provided

Error message

The parameter "name" is required

What it means

Thrown by POST settings.addCustomOAuth when the body 'name' field is missing or whitespace-only. The route registers a new custom OAuth provider by name; without a name there's nothing to register. Note this route is twoFactorRequired and gated to admins.

Source

Thrown at apps/meteor/server/api/v1/settings.ts:250

			POST: { permissions: ['add-oauth-service'], operation: 'hasAll' },
		},
		body: addCustomOAuthBodySchema,
		response: {
			200: ajv.compile<void>({
				type: 'object',
				properties: { success: { type: 'boolean', enum: [true] } },
				required: ['success'],
				additionalProperties: false,
			}),
			400: validateBadRequestErrorResponse,
			401: validateUnauthorizedErrorResponse,
			403: validateForbiddenErrorResponse,
		},
	},
	async function action() {
		const { name } = this.bodyParams;
		if (!name?.trim()) {
			throw new Meteor.Error('error-name-param-not-provided', 'The parameter "name" is required');
		}

		await addOAuthServiceMethod(this.userId, name);

		return API.v1.success();
	},
);

API.v1.post(
	'settings.removeCustomOAuth',
	{
		authRequired: true,
		twoFactorRequired: true,
		permissionsRequired: {
			POST: { permissions: ['add-oauth-service'], operation: 'hasAll' },
		},
		body: addCustomOAuthBodySchema,
		response: {

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Send a non-empty trimmed 'name' (e.g. 'google', 'github') in the body.
  2. Validate name.trim() on the client before submitting.
  3. Use a known provider key matching the OAuth app config you intend to fill in afterwards.

Example fix

// before
await rest.post('/api/v1/settings.addCustomOAuth', { name: '' });

// after
const name = 'google';
if (!name.trim()) throw new Error('OAuth provider name required');
await rest.post('/api/v1/settings.addCustomOAuth', { name });
Defensive patterns

Strategy: validation

Validate before calling

const name = (body.name ?? '').toString().trim();
if (!name) throw new Error('OAuth provider name required');
await rest.post('/api/v1/settings.addCustomOAuth', { name });

Type guard

function isNonEmptyName(s: unknown): s is string {
  return typeof s === 'string' && s.trim().length > 0;
}

Try / catch

try {
  await rest.post('/api/v1/settings.addCustomOAuth', { name });
} catch (e) {
  if (isMeteorError(e, 'error-name-param-not-provided')) {
    notify('Provider name is required.');
  } else throw e;
}

Prevention

When it happens

Trigger: POST /api/v1/settings.addCustomOAuth with an empty/missing/whitespace 'name' in the body.

Common situations: Automation that forgot to template the name; trailing-space-only value; form submitted with empty provider name.

Related errors


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