pipe-cd / pipe-cd/pipecd

pipectl migrate application-config panics on malformed application configuration

Open Beginner friendly
#6,980 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug
Dominant language
Go
Stars
1.4k
Forks
364
Avg merge
1d 4h
Merged PRs (30d)
84

Description

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

  1. Create a file named bad.yaml with the following content:
kind: KUBERNETES
  1. Run the migration command:
go run ./cmd/pipectl migrate application-config --config-files bad.yaml
  1. 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

  • piped version: N/A (issue reproduced using pipectl)
  • control-plane version: N/A
  • Others:
    • PipeCD branch: master
    • Commit: 5b81c813b
    • Go version: go1.26.2
    • OS: macOS (Apple Silicon)

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.

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 in pkg/app/pipectl/cmd/migrate/application_config.go at the unchecked parsing around line 142, then reproduce with bad.yaml containing only kind: KUBERNETES and the documented pipectl command. Trace how the parsed YAML reads spec and identify the validation path. Done means malformed configurations return a descriptive validation error instead of panicking.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.