pipectl migrate application-config panics on malformed application configuration
What happened
pipectl migrate application-config panics when the input application configuration is malformed instead of returning a descriptive validation error.
The panic occurs when the input configuration is missing required fields such as spec. Instead of reporting an invalid configuration, the command terminates with a Go panic:
panic: interface conversion: interface {} is nil, not map[string]interface {}
The panic originates from:
pkg/app/pipectl/cmd/migrate/application_config.go:142
What you expected to happen
The command should validate the input application configuration and return a descriptive error (for example, indicating that the required spec field is missing or invalid) instead of panicking.
How to reproduce it
- Create a file named
bad.yamlwith the following content:
kind: KUBERNETES
- Run the migration command:
go run ./cmd/pipectl migrate application-config --config-files bad.yaml
- Observe that the command panics with:
panic: interface conversion: interface {} is nil, not map[string]interface {}
Stack trace (truncated):
panic: interface conversion: interface {} is nil, not map[string]interface {}
github.com/pipe-cd/pipecd/pkg/app/pipectl/cmd/migrate.(*applicationConfig).migrateApplicationConfig(...)
pkg/app/pipectl/cmd/migrate/application_config.go:142
Environment
pipedversion: N/A (issue reproduced usingpipectl)control-planeversion: N/A- Others:
- PipeCD branch:
master - Commit:
5b81c813b - Go version:
go1.26.2 - OS: macOS (Apple Silicon)
- PipeCD branch:
Additional context
From the investigation, the panic is caused by unchecked type assertions while reading the parsed YAML (for example, assuming the spec field is always present and has the expected type). Returning a validation error instead of panicking would make the migration command more robust when handling malformed input.
If this behavior is considered a bug, I'd be happy to work on a fix and submit a PR.
I'd be happy to work on a fix for this issue and submit a PR if the proposed behavior sounds good.