Introduction
This guide will show you how to fix problems when copying a project, creating a template, or creating a project from a template. These actions can fail or behave incorrectly due to issues in the project tree structure or database configuration.
Symptoms
- Error message like:
"Project id= with parent_id=0: parent missing or without 'lft' value" - Project tree is broken – a project appears under the wrong parent in the project list or project detail view.
By following these steps, you’ll be able to restore correct project hierarchy and remove related errors.
Target Audience
- Administrator
Prerequisites
- Access to the server running Redmine
- Permissions to switch user to the one running Redmine
- Rights to edit MySQL configuration files
- Basic knowledge of Linux shell commands
How to Troubleshoot Project Copying and Template Creation
Step 1: Access the Server and Start Rails Console
- Log in to the server where Redmine is installed
- Switch to the Redmine user (the user Redmine runs under)
- Go to the Redmine folder (usually
/home/easy/current) - Start the Rails console with production environment:
bundle exec rails c RAILS_ENV=production
Step 2: Rebuild Trees
In the Rails console, run:
IssueTree.rebuild!
ProjectTree.rebuild!
These commands will rebuild the internal structure of issues and projects.
Step 3: Check the Result
Exit the console and check if the problem is resolved in the application interface.
Step 4: Change MySQL Settings if Needed
If the issue still exists:
- Open the MySQL configuration file:
sudo vim /etc/mysql/my.cnf
- In the
[mysqld]section, add the line:
transaction_isolation = SERIALIZABLE
- Save the file and restart MySQL:
sudo systemctl restart mysql
Step 5: Final Verification
Return to your Redmine application and test again. Project copying and template creation should now work correctly.
Conclusion
You have successfully fixed the problem related to project copying, template creation, or project creation from template. The error should no longer appear, and the project tree should now display correctly.
