Dolibarr/dolibarr · error
If define NOREQUIREUSER is set, you must also set…
Error message
If define NOREQUIREUSER is set, you must also set NOREQUIREMENU or not set it.
What it means
A second consistency check in main.inc.php: pages that define NOREQUIREUSER (skip loading the user object) must also define NOREQUIREMENU, because menu rendering depends on the loaded user. Without it Dolibarr prints this message and exits before doing any more work.
Solutions
- Add define('NOREQUIREMENU', 1) next to define('NOREQUIREUSER', 1)
- Remove NOREQUIREUSER if your page needs the $user object anyway
- Audit all custom entry points for define-set consistency after upgrading Dolibarr
Example fix
// before
define('NOREQUIREUSER', 1);
require '../main.inc.php';
// after
define('NOREQUIREUSER', 1);
define('NOREQUIREMENU', 1);
require '../main.inc.php'; Defensive patterns
Strategy: validation
Validate before calling
if (defined('NOREQUIREUSER') && !defined('NOREQUIREMENU')) { define('NOREQUIREMENU', 1); } Prevention
- Whenever you skip user loading, always skip menu loading too
- Copy complete define blocks from a recent Dolibarr skeleton page (e.g. public/demo pages)
- Grep your custom pages for NOREQUIREUSER and verify NOREQUIREMENU is present
When it happens
Trigger: An entry script calls define('NOREQUIREUSER', 1) then includes main.inc.php without define('NOREQUIREMENU', 1).
Common situations: Public pages (login, install, cron) that skip authentication but copied only part of the required define set; upgrade of Dolibarr adding the new guard to legacy pages.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- If define NOREQUIREDB or NOREQUIRETRAN are set, you must…
- ErrorFileSizeTooLarge ErrorGoBackAndCorrectParameters
- If you access your server behind a proxy using url…
- ErrorConfigParameterNotDefined
- Error: Wrong $dolibarr_main_url_root_alt value in conf.php…
AI-assisted analysis of Dolibarr/dolibarr@598aa4bdad (2026-09-14).
Data as JSON: /api/errors/76ce0b891fed10b4.
Report an issue: GitHub.
Appendix: source
Thrown at htdocs/main.inc.php:66
if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) {
[$usec, $sec] = explode(" ", microtime());
$micro_start_time = ((float) $usec + (float) $sec);
// Add Xdebug code coverage
//define('XDEBUGCOVERAGE',1);
if (defined('XDEBUGCOVERAGE')) {
xdebug_start_code_coverage();
}
}
require __DIR__.'/waf.inc.php';
// Check consistency of NOREQUIREXXX DEFINES
if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && !defined('NOREQUIREMENU')) {
print 'If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not set them.';
exit;
}
if (defined('NOREQUIREUSER') && !defined('NOREQUIREMENU')) {
print 'If define NOREQUIREUSER is set, you must also set NOREQUIREMENU or not set it.';
exit;
}
// This is to make Dolibarr working with Plesk
if (!empty($_SERVER['DOCUMENT_ROOT']) && substr($_SERVER['DOCUMENT_ROOT'], -6) !== 'htdocs') {
set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
}
// Include the conf.php and functions.lib.php and security.lib.php. This defined the constants like DOL_DOCUMENT_ROOT, DOL_DATA_ROOT, DOL_URL_ROOT...
require_once 'filefunc.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var ?string $php_session_save_handlerView on GitHub (pinned to 598aa4bdad)