Unable to load the requested language file: language/en/form_validation_lang.php
In CodeIgniter 2.1.4, loading the form_validation library is a standard procedure for handling input sanitization and rule enforcement. However, developers often encounter the "Unable to load the requested language file" error when initializing this library, even if they haven't explicitly referenced any custom validation messages in their code yet.
This specific error message indicates that CodeIgniter attempted to load a default language file located at application/language/en/form_validation_lang.php. The framework checks for this file immediately upon instantiation of the library to ensure it can access default translation strings, such as "The username field is required" or generic error messages associated with validation rules. If this file is missing from your project structure, the application halts execution and displays the raw PHP error you are seeing.
The root cause in your scenario is that the form_validation library expects the language file to exist by default. Even though you have not called $this->lang->line('validation_email') or defined custom messages yet, the library loads the file during its initialization phase to populate the internal message map with default values. The framework does not skip loading this file just because you haven't used the default messages in your logic yet.
To resolve this issue without creating a custom language file immediately, you have two primary options depending on your project needs.
Option 1: Create the Missing Language File
The most straightforward fix is to create the missing file at application/language/en/form_validation_lang.php. You can copy this file from the CodeIgniter installation directory (usually found in system/language/english/) into your application's language folder. This restores the default behavior where validation errors are handled gracefully using the framework's built-in English strings.
Once you have copied the file, ensure that the path matches exactly:application/language/en/form_validation_lang.php
Note that CodeIgniter 2.x is case-sensitive regarding file paths and language folders. The folder must be named en (lowercase) if your configuration specifies 'language' => 'en' in config/config.php. If your system folder is lowercase but your application folder has a different casing, the loader will fail to find it.
Option 2: Disable Default Language Loading
If you prefer not to manage language files or want to define all validation messages dynamically within your controller (as you are doing with set_message in your isEmailExist callback), you can configure the library to ignore the default language file.
You can achieve this by modifying how you load the library or by altering the form_validation configuration. However, in CodeIgniter 2.x, there isn't a direct configuration flag to skip loading the language file entirely upon instantiation. Therefore, the standard practice for customizing validation messages is to ensure the default file exists so it doesn't crash on load, and then override specific lines using $this->form_validation->set_message().
In your provided code snippet, you are already using set_message for the isEmailExist rule. This is correct behavior. However, if you define custom messages for other rules like 'required' or 'valid_email', those strings must also be available in the loaded language file unless you override them.
A Note on Callbacks and Language Files
Your implementation of callback_isEmailExist attempts to set a message dynamically:
$this->form_validation->set_message('isEmailExist', 'Email address is already exist.');
This approach works well for custom callbacks. However, be aware that if the default language file is missing and CodeIgniter cannot load it, the framework throws a fatal error before it can even reach your logic to apply these dynamic messages. The library initialization happens before you enter the if ($this->form_validation->run() == FALSE) block.
If you are moving away from static language files, ensure that you handle all potential validation errors explicitly within your controller logic rather than relying on default strings. This adds a layer of responsibility to your code but gives you full control over error display.
Migration Considerations
Since you are using CodeIgniter 2.1.4, it is worth noting that the framework is no longer receiving security updates. While this solution resolves the immediate language file error, consider evaluating a migration path to a modern version like CodeIgniter 3 or Laravel for long-term maintainability. If you are already familiar with Laravel, the approach to validation is similar but relies on service containers and lang() helpers that behave differently regarding default file loading.
For now, copying the standard form_validation_lang.php from your system folder into your application's language directory is the quickest way to restore stability and allow your custom callback logic to function as intended.