devspace icon indicating copy to clipboard operation
devspace copied to clipboard

panic: assignment to entry in nil map

Open hookenz opened this issue 6 months ago • 1 comments

What happened?
Attempted to use devspace init on an existing project. Chose the option to use the existing docker-compose.yaml that I had

panic: assignment to entry in nil map

goroutine 1 [running]:
github.com/compose-spec/compose-go/loader.Load({{0x0, 0x0}, {0x0, 0x0}, {0xc00085ab10, 0x1, 0x1}, 0x0}, {0x0, 0x0, ...})
	/Users/runner/work/devspace/devspace/vendor/github.com/compose-spec/compose-go/loader/loader.go:218 +0x69e
github.com/loft-sh/devspace/pkg/devspace/compose.LoadDockerComposeProject({0x24c7bf1?, 0xa90774?})
	/Users/runner/work/devspace/devspace/pkg/devspace/compose/manager.go:41 +0x125
github.com/loft-sh/devspace/cmd.(*InitCmd).initDockerCompose(0xc0006aa140, {0x0?, 0x0?}, {0x24c7bf1?, 0x1?})
	/Users/runner/work/devspace/devspace/cmd/init.go:551 +0x38
github.com/loft-sh/devspace/cmd.(*InitCmd).Run(0xc0006aa140, {0x2a43e68, 0x453ba00})
	/Users/runner/work/devspace/devspace/cmd/init.go:160 +0x355
github.com/loft-sh/devspace/cmd.NewInitCmd.func1(0xc0007f5b08?, {0x453ba00?, 0x4?, 0x24ab4a7?})
	/Users/runner/work/devspace/devspace/cmd/init.go:94 +0x47
github.com/spf13/cobra.(*Command).execute(0xc0007f5b08, {0x453ba00, 0x0, 0x0})
	/Users/runner/work/devspace/devspace/vendor/github.com/spf13/cobra/command.go:940 +0x882
github.com/spf13/cobra.(*Command).ExecuteC(0xc0004d2008)
	/Users/runner/work/devspace/devspace/vendor/github.com/spf13/cobra/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/runner/work/devspace/devspace/vendor/github.com/spf13/cobra/command.go:992
github.com/loft-sh/devspace/cmd.Execute()
	/Users/runner/work/devspace/devspace/cmd/root.go:151 +0x1be
main.main()
	/Users/runner/work/devspace/devspace/main.go:17 +0x2a

What did you expect to happen instead?
Not this.

How can we reproduce the bug? (as minimally and precisely as possible)

My docker-compose.yaml

name: serverkit

services:
  serverkit:
    image: serverkit:latest
    container_name: serverkit
    ports:
      - '8080:8080'
    environment:
      PHP_OPCACHE_ENABLE: "1"
      SYSTEM_KEY: ${SYSTEM_KEY}
      SYSTEM_SECRET: ${SYSTEM_SECRET}
      EXTERNAL_URL: ${EXTERNAL_URL}
      GITHUB_TOKEN: ${GITHUB_TOKEN}
    volumes:
      - serverkit:/data
    
volumes:
  serverkit:
    name: serverkit_data

**Local Environment:**  
- DevSpace Version: devspace version 6.3.15
- Operating System: linux
- ARCH of the OS: AMD64
**Kubernetes Cluster:**  
- Cloud Provider: aws
- Kubernetes Version: 
      Client Version: v1.33.2
      Kustomize Version: v5.6.0
      Server Version: v1.32.5-eks-5d4a308

Anything else we need to know?

That makes using devspace a no go for me. I was wanting to see how it compared to Tilt, but unfortunately out of the gate it's broken.

hookenz avatar Jun 26 '25 23:06 hookenz

Thanks for the report. Looks like this is a bug in this version of compose-go where they're trying to assign to the Environment map with out checking for nil. Subsequent versions seems to have corrected this and we'll have to update our dependency.

zerbitx avatar Jun 27 '25 14:06 zerbitx