craftcms / craftcms/cms

[3.x]: ./craft install handles errors poorly

Open
#11,431 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug craft3
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

What happened?
Description

./craft install fails on the "applying existing project config ... " step. The only way I've found to fix this is to go to another instance of the site (eg. one of my colleague's development versions), rebuild the project yaml and commit the changes.

Once I've got the new yaml files, I run ./craft install again but it says "Craft is already installed!" and exits, but the site does not work as

  1. there's no security key
  2. the project config has not been synced from the yaml
  3. there is no default admin
  4. default pages don't exist

I also found that I could not create a homepage (after manually creating a security key, user, and syncing the config) as none of the "Singles" sections appeared under entries where the homepage would normally be configured.

Steps to reproduce
  1. Clone a project
  2. run ./craft install. This almost always fails in my experience but i'm hoping if I start manually running ./craft project-config/rebuild every time I change something in the settings it will fix it.
  3. fix the project config
  4. run ./craft install again
Expected behavior

If ./craft install fails once and you rerun it, it will check if it needs subtask individually and execute them if required

Actual behavior

./craft install skips all subtasks regardless of if they need running

Craft CMS version

5.7.44

PHP version

7.4

Operating system and version

php:7.4-apache

Database type and version

mysql:latest

Image driver and version

n/a

Installed plugins and versions

From project.yaml

  • buttonbox
  • cp-css
  • cp-field-inspect
  • cp-js
  • embedded-assets-link
  • embeddedassets
  • expanded-singles
  • formie
  • imager-x
  • instagramfeed
  • linkit
  • neo
  • recaptcha
  • redactor
  • seomatic
  • tablemaker

from composer.json

"codemonauts/craft-instagram-feed": "1.1.8",
"craftcms/cms": "3.7.44",
"craftcms/fix-fks": "^1.0.2.1",
"craftcms/redactor": "2.10.8",
"doublesecretagency/craft-cpcss": "2.4.0",
"doublesecretagency/craft-cpjs": "2.4.0",
"fruitstudios/linkit": "^1.1.12.1",
"marionnewlevant/embedded-assets-link": "^1.0.3",
"matt-west/craft-recaptcha": "1.5.3",
"mmikkel/cp-field-inspect": "1.4.4",
"nystudio107/craft-seomatic": "3.4.31",
"spacecatninja/imager-x": "v3.5.8",
"spicyweb/craft-embedded-assets": "2.10.7",
"spicyweb/craft-neo": "2.13.11",
"verbb/buttonbox": "3.0.0",
"verbb/expanded-singles": "1.2.0",
"verbb/formie": "1.5.19",
"verbb/tablemaker": "3.0.0",
"vlucas/phpdotenv": "^3.4.0"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with ./craft install, then compare its behavior with ./craft project-config/rebuild and the listed post-failure state. Trace which install subtasks are skipped on a second run; done means rerunning install executes each required subtask and restores the security key, project config, default admin, and default pages.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.