Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidConfigProviderException: Mezzio\Helper\ConfigProvider is registered more than once #161

Open
galvao opened this issue Nov 14, 2024 · 5 comments
Labels
Bug Something isn't working

Comments

@galvao
Copy link

galvao commented Nov 14, 2024

Bug Report

Q A
Version(s) 3.15.0

Summary

Clean installation results in an error after running bin/clear-config-cache.php

Current behavior

Script php bin/clear-config-cache.php handling the clear-config-cache event returned with error code 255
Script @clear-config-cache was called via post-update-cmd

How to reproduce

Just do a clean project creation: composer create-project mezzio/mezzio-skeleton dir_name
Using composer's --no-cache flag yields the same error.

Expected behavior

Finish the project creation without errors.

@galvao galvao added the Bug Something isn't working label Nov 14, 2024
@matthewpallotta
Copy link

Removing line 19 \Mezzio\Helper\ConfigProvider::class from config\config.php should fix the issue.
Conflicts with line 25 ConfigProvider::class

This fixed my issue with the current skeleton.

@alexmerlin
Copy link
Member

We cannot remove ConfigProviders from config/config.php because, depending how the project is installed, one might choose not to inject ConfigProviders into config/config.php, leading to the opposite of the current situation where ConfigProviders are not registered at all.
@Xerkus what do you think?

@froschdesign
Copy link
Member

Maybe the renaming under version 3 of laminas-component-installer is the problem: laminas/laminas-component-installer#52

See: https://docs.laminas.dev/laminas-component-installer/#marking-packages-to-auto-install

@galvao
Copy link
Author

galvao commented Nov 19, 2024

I can confirm @matthewpallotta's solution:

  1. Started a fresh install with composer create-project;
  2. Received the error message;
  3. Edited config/config.php and deleted line 19;
  4. Ran composer update and the problem is gone.

Thank you, Matthew!

P.S.: Haven't ran a full test yet (meaning, running the actual application), will update this soon to let you know.

@rhengles
Copy link

rhengles commented Dec 2, 2024

The title and description of this issue are horrible for SEO

So let me spell the actual error:

InvalidConfigProviderException: Mezzio\Helper\ConfigProvider is registered more than once mezzio/mezzio#203

Fatal error: Uncaught Laminas\ConfigAggregator\InvalidConfigProviderException: Mezzio\Helper\ConfigProvider is
registered more than once. Config providers should be unique. In case a specific order is required, please double
check before deleting the duplicate(s). in ***\vendor\laminas\laminas-config-aggregator\src
\InvalidConfigProviderException.php:15
Stack trace:
    #0 ***\vendor\laminas\laminas-config-aggregator\src\ConfigAggregator.php(117): Laminas\ConfigAggregator\InvalidConfigProviderException::fromDuplicateProvider('Mezzio\\Helper\\C...')
    #1 ***\vendor\laminas\laminas-config-aggregator\src\ConfigAggregator.php(85): Laminas\ConfigAggregator\ConfigAggregator->validateNoDuplicateProviders(Array)
    #2 ***\config\config.php(16): Laminas\ConfigAggregator\ConfigAggregator->__construct(Array, 'data/cache/conf...')
    #3 ***\bin\clear-config-cache.php(9): include('***\project\...')
    #4 {main}
  thrown in ***\vendor\laminas\laminas-config-aggregator\src\InvalidConfigProviderException.php on line 15

@froschdesign froschdesign changed the title Error after running clear-config-cache.php InvalidConfigProviderException: Mezzio\Helper\ConfigProvider is registered more than once Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants