GoogleContainerTools/skaffold · error

container %q has no command-line

Error message

container %q has no command-line

What it means

Fires in the Delve (dlv) transformer's Apply when the container being configured for Go debugging has neither an entrypoint nor a command in its image/container spec, so there is no user program for `dlv exec`/connect to target.

Source

Thrown at pkg/skaffold/debug/transform_go.go:131

func (t dlvTransformer) Apply(adapter types.ContainerAdapter, config ImageConfiguration, portAlloc PortAllocator, overrideProtocols []string) (types.ContainerDebugConfiguration, string, error) {
	container := adapter.GetContainer()
	log.Entry(context.TODO()).Infof("Configuring %q for Go/Delve debugging", container.Name)

	// try to find existing `dlv` command
	spec := retrieveDlvSpec(config)

	if spec == nil {
		newSpec := newDlvSpec(uint16(portAlloc(defaultDlvPort)))
		spec = &newSpec
		switch {
		case len(config.Entrypoint) > 0 && !isEntrypointLauncher(config.Entrypoint):
			container.Command = rewriteDlvCommandLine(config.Entrypoint, *spec, container.Args)

		case (len(config.Entrypoint) == 0 || isEntrypointLauncher(config.Entrypoint)) && len(config.Arguments) > 0:
			container.Args = rewriteDlvCommandLine(config.Arguments, *spec, container.Args)

		default:
			return types.ContainerDebugConfiguration{}, "", fmt.Errorf("container %q has no command-line", container.Name)
		}
	}

	container.Ports = exposePort(container.Ports, "dlv", int32(spec.port))

	return types.ContainerDebugConfiguration{
		Runtime: "go",
		Ports:   map[string]uint32{"dlv": uint32(spec.port)},
	}, "go", nil
}

func retrieveDlvSpec(config ImageConfiguration) *dlvSpec {
	if spec := extractDlvSpec(config.Entrypoint); spec != nil {
		return spec
	}
	if spec := extractDlvSpec(config.Arguments); spec != nil {
		return spec
	}

View on GitHub (pinned to a1189de023)

Solutions

  1. Add a command or entrypoint to the container/image so the Go program to debug is identified
  2. Rebuild the image so the builder sets a proper ENTRYPOINT/CMD
  3. Set the command explicitly in the Kubernetes manifest for that container
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/skaffold/debug/transform_go.go:131 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/e9ce0c768e497d18. Report an issue: GitHub.