GoogleContainerTools/skaffold · error

failed to create %v action

Error message

failed to create %v action

What it means

After PrepareActions runs, Exec expects exactly one Action to be created for the given name. If the count is zero (or unexpectedly more than one), it reports the action could not be created. This indicates the action's execEnv failed to materialize an Action instance despite the name being registered.

Source

Thrown at pkg/skaffold/actions/runner.go:75

}

func (r Runner) Exec(ctx context.Context, out io.Writer, allbuilds, localImgs []graph.Artifact, aName string) error {
	execEnv, found := r.execEnvByAction[aName]
	if !found {
		return fmt.Errorf("custom action %v not found", aName)
	}

	output.Default.Fprintln(out, fmt.Sprintf("Starting execution for %v", aName))
	log.Entry(ctx).Debugf("Starting execution for %v", aName)

	acs, err := execEnv.PrepareActions(ctx, out, allbuilds, localImgs, []string{aName})
	if err != nil {
		return err
	}

	// We expect only one action to be created.
	if len(acs) != 1 {
		return fmt.Errorf("failed to create %v action", aName)
	}

	a := acs[0]

	err = a.Exec(ctx, out)
	log.Entry(ctx).Debugf("Finished execution for %v", a.name)
	r.cleanup(context.TODO(), out, []Task{a}, []ExecEnv{execEnv})
	return err
}

func (r Runner) prepareAllActions(ctx context.Context, out io.Writer, allbuilds, localImgs []graph.Artifact) ([]Task, error) {
	preparedAcs := []Task{}
	for _, execEnv := range r.orderedExecEnvs {
		acsNames := r.acsByExecEnv[execEnv]
		acs, err := execEnv.PrepareActions(ctx, out, allbuilds, localImgs, acsNames)
		if err != nil {
			return nil, err
		}

View on GitHub (pinned to a1189de023)

Solutions

  1. Validate skaffold.yaml (skaffold fix / schema check) for the action's definition
  2. Ensure required fields of the action (e.g. k8sjob container spec, manifest) are present
  3. Build dependencies first so allbuilds/localImgs are populated before Exec
  4. Run with --vdebug to see PrepareActions internal filtering

Example fix

// before
customActions:
  - name: test
    k8sjob:
      manifests: []
// after
customActions:
  - name: test
    k8sjob:
      manifests:
        - rawYaml: [job.yaml]
Defensive patterns

Strategy: validation

Validate before calling

// validate the action's manifest before running
kubectl apply --dry-run=client -f job.yaml || echo "fix action manifest"

Prevention

When it happens

Trigger: execEnv.PrepareActions returns 0 actions for the requested name — e.g. the action exists in execEnvByAction but PrepareActions filters it out due to malformed action config (bad k8sjob spec, missing required fields) that doesn't surface as a normal error.

Common situations: Partially-valid skaffold.yaml where the action is registered but its build/run config can't be resolved (missing build artifact dependency, empty k8sjob manifest section); using `allbuilds`/localImgs that the action depends on but that were not built.

Related errors


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