GoogleContainerTools/skaffold · error
parsing ONBUILD instructions: %w
Error message
parsing ONBUILD instructions: %w
What it means
Fires in expandOnbuildInstructions when the ONBUILD triggers inherited from a base image cannot be parsed. Skaffold fetches base-image ONBUILD instructions (from the local daemon or remote registry) and re-parses them as Dockerfile AST nodes to track COPY dependencies; failure means the base image's ONBUILD commands were not parseable.
Source
Thrown at pkg/skaffold/docker/parse.go:398
from := fromInstruction(node)
// onbuild should immediately follow the from command
expandedNodes = append(expandedNodes, nodes[n:m+1]...)
n = m + 1
var onbuildNodes []*parser.Node
if ons, found := onbuildNodesCache[strings.ToLower(from.image)]; found {
onbuildNodes = ons
} else if from.image == "" {
// some build args like artifact dependencies are not available until the first build sequence has completed.
// skip check if there are unavailable images
onbuildNodes = []*parser.Node{}
} else if ons, err := parseOnbuild(ctx, from.image, cfg); err == nil {
onbuildNodes = ons
} else if warnMsg, ok, _ := isOldImageManifestProblem(cfg, err); ok && warnMsg != "" {
log.Entry(context.TODO()).Warn(warnMsg)
} else if !ok {
return nil, fmt.Errorf("parsing ONBUILD instructions: %w", err)
}
// Stage names are case insensitive
onbuildNodesCache[strings.ToLower(from.as)] = nodes
onbuildNodesCache[strings.ToLower(from.image)] = nodes
expandedNodes = append(expandedNodes, onbuildNodes...)
}
}
expandedNodes = append(expandedNodes, nodes[n:]...)
return expandedNodes, nil
}
func parseOnbuild(ctx context.Context, image string, cfg Config) ([]*parser.Node, error) {
log.Entry(context.TODO()).Tracef("Checking base image %s for ONBUILD triggers.", image)
// Image names are case SENSITIVEView on GitHub (pinned to a1189de023)
Solutions
- Pull the base image again (docker pull <base>) to ensure a complete, uncorrupted manifest
- Use a base image with simpler/valid ONBUILD instructions or avoid ONBUILD-based COPY triggers
- Report to skaffold maintainers if the base image is valid and the failure persists
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/skaffold/docker/parse.go:398 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/b409043b6427a80c.
Report an issue: GitHub.