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 request body has no usable "name" field (missing, empty, or whitespace-only). The route registers a new custom OAuth provider and needs the provider name to build its setting group. It is admin-only (add-oauth-service permission) and protected by two-factor authentication, but the name check runs before any of that business logic.

Solutions

  1. Send a non-empty trimmed name: {"name": "github-enterprise"} with Content-Type: application/json
  2. If the body looks correct, verify it is actually parsed: no form-encoding mixups, no trailing commas, valid JSON
  3. Check for key typos — only "name" is read from bodyParams
  4. Remember the route also requires the add-oauth-service permission and an X-2FA-Code header; fix the name first since this error fires before those checks complete

Example fix

// before
await sdk.post('settings.addCustomOAuth', { serviceName: 'custom-saml' });
// after
await sdk.post('settings.addCustomOAuth', { name: 'custom-saml' });
Defensive patterns

Strategy: validation

Validate before calling

const name = typeof body?.name === 'string' ? body.name.trim() : '';
if (!name) throw new Error('settings.addCustomOAuth requires a non-empty "name"');
await sdk.post('settings.addCustomOAuth', { name });

Type guard

const isNonEmptyName = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0;

Try / catch

catch (e) { if (e?.error === 'error-name-param-not-provided') fixBodyName(); else throw e; }

Prevention

When it happens

Trigger: POST /api/v1/settings.addCustomOAuth with body {}, {"name": ""}, or {"name": " "}; sending the field under a different key (serviceName, provider); sending JSON without Content-Type: application/json so bodyParams ends up empty.

Common situations: Automation scripts that template the OAuth provider name from an empty variable; clients porting from the old addOAuthService method call that used a different payload shape; CI provisioning that runs before the config file with provider names is loaded.

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@2a7de45707 (2026-08-18). Data as JSON: /api/errors/bc0135fd7856504b. Report an issue: GitHub.

Appendix: source

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

			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 2a7de45707)