{"record":{"id":"3839993786b40560","repo":"Dolibarr/dolibarr","slug":"error-the-captcha-handler-captcha-has-no-class-file-found","errorCode":null,"errorMessage":"Error, the captcha handler ${captcha} has no class file found modCaptcha${Captcha}","messagePattern":"Error, the captcha handler (.+?) has no class file found modCaptcha(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"htdocs/main.inc.php","lineNumber":664,"sourceCode":"\t\t\t\tif (class_exists($classname)) {\n\t\t\t\t\t/** @var ModeleCaptcha $captchaobj */\n\t\t\t\t\t$captchaobj = new $classname($db, $conf, $langs, $user);\n\t\t\t\t\t'@phan-var-force ModeleCaptcha $captchaobj';\n\n\t\t\t\t\tif (is_object($captchaobj) && method_exists($captchaobj, 'validateCodeAfterLoginSubmit')) {\n\t\t\t\t\t\t$ok = $captchaobj->validateCodeAfterLoginSubmit(); // @phan-suppress-current-line PhanUndeclaredMethod\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$_SESSION[\"dol_loginmesg\"] =  'Error, the captcha handler '.get_class($captchaobj).' does not have any method validateCodeAfterLoginSubmit()';\n\t\t\t\t\t\t$test = false;\n\t\t\t\t\t\t$error++;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$_SESSION[\"dol_loginmesg\"] =  'Error, the captcha handler class '.$classname.' was not found after the include';\n\t\t\t\t\t$test = false;\n\t\t\t\t\t$error++;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$_SESSION[\"dol_loginmesg\"] = 'Error, the captcha handler '.$captcha.' has no class file found modCaptcha'.ucfirst($captcha);\n\t\t\t\t$test = false;\n\t\t\t\t$error++;\n\t\t\t}\n\n\t\t\t// Process error of captcha validation\n\t\t\tif (!$ok) {\n\t\t\t\tdol_syslog('--- Security warning: Bad value for code, connection refused', LOG_NOTICE);\n\t\t\t\t// Load translation files required by page\n\t\t\t\t$langs->loadLangs(array('main', 'errors'));\n\n\t\t\t\t$_SESSION[\"dol_loginmesg\"] = (empty($_SESSION[\"dol_loginmesg\"]) ? \"\" : $_SESSION[\"dol_loginmesg\"].\"<br>\\n\").$langs->transnoentitiesnoconv(\"ErrorBadValueForCode\");\n\t\t\t\t$test = false;\n\n\t\t\t\t// Call trigger for the \"security events\" log\n\t\t\t\t$user->context['audit'] = 'ErrorBadValueForCode - login='.GETPOST(\"username\", \"alpha\", 2);\n\n\t\t\t\t// Call trigger\n\t\t\t\t$result = $user->call_trigger('USER_LOGIN_FAILED', $user);","sourceCodeStart":646,"sourceCodeEnd":682,"githubUrl":"https://github.com/Dolibarr/dolibarr/blob/598aa4bdada683d17ca04b1842548821ff0eb6c6/htdocs/main.inc.php#L646-L682","documentation":"Before including any captcha handler, Dolibarr looks for the module file core/modules/captcha/modCaptcha<ucfirst($captcha)>.class.php. When that file does not exist, the login flow rejects the attempt with this message in the session. It indicates the configured captcha module name has no corresponding file on disk.","triggerScenarios":"The captcha configuration set to an unknown/misspelled module name so modCaptcha<Name>.class.php cannot be found.","commonSituations":"Typo in the captcha setup value; captcha module directory missing after an incomplete upgrade or an rsync excluding the folder; third-party captcha module not installed on the new server.","solutions":["Check Setup > Security for the selected captcha value and fix typos.","Install the missing captcha module so core/modules/captcha/modCaptcha<Name>.class.php exists.","Verify file permissions/readability of htdocs/core/modules/captcha/ after deployment.","Temporarily disable captcha to restore login, then fix the module.","Re-sync the codebase after upgrades to ensure the captcha directory was deployed."],"exampleFix":"// before (config)\ncaptcha = 'reyg'; // no such module\n// after\ncaptcha = 'recaptcha'; // modCaptchaRecaptcha.class.php exists","handlingStrategy":"validation","validationCode":"$file = DOL_DOCUMENT_ROOT.'/core/modules/captcha/modCaptcha'.ucfirst($captcha).'.class.php';\nif (!is_readable($file)) { die(\"Captcha module '$captcha' is not installed: $file missing\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only select captcha modules that appear in the setup dropdown","Verify module file presence in deployment smoke tests","Keep codebase deployments atomic (no partial rsyncs)"],"tags":["dolibarr","captcha","missing-module"],"backgroundTag":"file-not-found","analyzedSha":"598aa4bdada683d17ca04b1842548821ff0eb6c6","analyzedAt":"2026-09-14T11:12:15.309Z","contentChangedAt":"2026-09-14T11:12:15.309Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}