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

Error Module module-name is declared multiple times (in 'path/to/garden.yml' and 'path/to/garden.yml') #3464

Closed
xdvpser opened this issue Dec 21, 2022 · 2 comments

Comments

@xdvpser
Copy link

xdvpser commented Dec 21, 2022

Bug

Current Behavior

Garden produces error:

Module module-name is declared multiple times  (in 'same/path/to/garden.yml' and 'same/path/to/garden.yml')

Expected behavior

No error

Additional context

Basically, I have setup as described further:

root-dir/
  project.garden.yml
  tpls/
    tpl.garden.yml
  modules/
    # these modules are templated modules that might use root-dir/tpls/tpl.garden.yml ModuleTemplate
    mdl-one/garden.yml
    mdl-two/garden.yml
    etc.

Modules in modules/ directory are of various types and can depend on each other. There is only one particular templated module that cannot be properly processed, while other templated modules work fine.
From silly logs I found that it is loaded and added twice:

# this message is appearing the first among similar messages
{"msg":"Load module and workflow configs from /root-dir/modules/mdl-one/garden.yml","section":"","timestamp":"2022-12-21T09:10:35.620Z","level":"silly","allSections":[]}
{"msg":"Load module and workflow configs from /root-dir/modules/mdl-one/garden.yml","section":"","timestamp":"2022-12-21T09:10:35.622Z","level":"silly","allSections":[]}
# this message is appearing the first among similar messages
{"msg":"Adding module mdl-one","section":"","timestamp":"2022-12-21T09:10:36.581Z","level":"silly","allSections":[]}
{"msg":"Adding module mdl-one","section":"","timestamp":"2022-12-21T09:10:36.583Z","level":"silly","allSections":[]}

And finally error message with stack trace:

Error: Module mdl-one is declared multiple times (in 'root-dir/modules/mdl-one/garden.yml' and 'root-dir/modules/mdl-one/garden.yml')
    at Garden.addModuleConfig (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/src/garden.ts:1033:13)
    at Garden.wrapped (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/src/util/profiling.ts:149:39)
    at /snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/src/garden.ts:1003:63
    at tryCatcher (/snapshot/project/tmp/pkg/cli/node_modules/bluebird/js/release/util.js:16:23)
    at MappingPromiseArray._promiseFulfilled (/snapshot/project/tmp/pkg/cli/node_modules/bluebird/js/release/map.js:68:38)
    at MappingPromiseArray.<anonymous> (/snapshot/project/tmp/pkg/cli/node_modules/bluebird/js/release/promise_array.js:115:31)
    at MappingPromiseArray.init (/snapshot/project/tmp/pkg/cli/node_modules/bluebird/js/release/promise_array.js:79:10)
    at MappingPromiseArray._asyncInit (/snapshot/project/tmp/pkg/cli/node_modules/bluebird/js/release/map.js:37:10)
    at _drainQueueStep (/snapshot/project/tmp/pkg/cli/node_modules/bluebird/js/release/async.js:97:12)
    at _drainQueue (/snapshot/project/tmp/pkg/cli/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/snapshot/project/tmp/pkg/cli/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.<anonymous> (/snapshot/project/tmp/pkg/cli/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:464:21)

Error Details:

pathA: root-dir/modules/mdl-one/garden.yml
pathB: root-dir/modules/mdl-one/garden.yml

I've also tried to remove .garden directory hoping it will somehow help, but unfortunately it didn't(

Your environment

  • OS: ubuntu 20.04
  • How I'm running Kubernetes: self-managed with Kops on AWS

garden version: tried from 0.12.45 to 0.12.48

@xdvpser
Copy link
Author

xdvpser commented Dec 21, 2022

I've resolved issue by completely removing k8s garden environment. Most likely such error was caused by upgrading Garden CLI from 0.12.47 to 0.12.48 with already existing/deployed k8s garden environment. I.e:

$ garden deploy
$ garden self-update
$ garden deploy <some-new-module>  # exits with error

@vvagaytsev
Copy link
Collaborator

@xdvpser thanks for reporting this and a workaround! If it no longer happens, can we close the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants