Dolibarr/dolibarr · critical

ErrorConfigParameterNotDefined

Error message

ErrorConfigParameterNotDefined (${param}: dolibarr_main_authentication)

What it means

Dolibarr aborts startup when the authentication mode list read from conf.php ($dolibarr_main_authentication) is empty, so no authentication module can be selected. dol_print_error renders ErrorConfigParameterNotDefined naming the missing parameter, then the script exits. It guards against a config file that cannot authenticate anyone.

Solutions

  1. Edit htdocs/conf/conf.php (or conf.php outside htdocs) and set $dolibarr_main_authentication, e.g. 'dolibarr' or 'http,dolibarr'.
  2. If unsure, copy the value from conf.php.example and adapt it to your auth modules.
  3. Restart/flush PHP opcache and reload the login page.
  4. Verify with php -r that the included config yields a non-empty $dolibarr_main_authentication.

Example fix

// before (conf.php)
$dolibarr_main_authentication = '';
// after
$dolibarr_main_authentication = 'dolibarr';
Defensive patterns

Strategy: validation

Validate before calling

if (empty($dolibarr_main_authentication)) { die('conf.php: $dolibarr_main_authentication must be set, e.g. dolibarr'); }

Prevention

When it happens

Trigger: conf.php defines $dolibarr_main_authentication as an empty string or the variable is not defined at all when main.inc.php runs; explode(',', '') yields an array whose count check fails the !count($authmode) test.

Common situations: Fresh installs where conf.php was hand-copied without the authentication line; config regeneration tools that strip the parameter; typos like $dolibarr_autentication; deployments where conf.php was overwritten by an automated installer.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of Dolibarr/dolibarr@598aa4bdad (2026-09-14). Data as JSON: /api/errors/47724df670db7028. Report an issue: GitHub.

Appendix: source

Thrown at htdocs/main.inc.php:560

	if (defined('MAIN_AUTHENTICATION_MODE')) {
		$dolibarr_main_authentication = constant('MAIN_AUTHENTICATION_MODE');
	} else {
		// Authentication mode
		if (empty($dolibarr_main_authentication)) {
			$dolibarr_main_authentication = 'dolibarr';
		}
		// Authentication mode: forceuser
		if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) {
			$dolibarr_auto_user = 'auto';
		}
	}
	// Set authmode
	$authmode = explode(',', $dolibarr_main_authentication);

	// No authentication mode
	if (!count($authmode)) {
		$langs->load('main');
		dol_print_error(null, $langs->trans("ErrorConfigParameterNotDefined", 'dolibarr_main_authentication'));
		exit;
	}

	// If login request was already post, we retrieve login from the session
	// Call module if not realized that his request.
	// At the end of this phase, the variable $login is defined.
	$resultFetchUser = '';
	$test = true;
	$dol_authmode = null;

	if (!isset($_SESSION["dol_login"])) {
		// It is not already authenticated and it requests the login / password
		include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';

		$dol_dst_observed = GETPOSTINT("dst_observed", 3);
		$dol_dst_first = GETPOSTINT("dst_first", 3);
		$dol_dst_second = GETPOSTINT("dst_second", 3);
		$dol_screenwidth = GETPOSTINT("screenwidth", 3);

View on GitHub (pinned to 598aa4bdad)