{"record":{"id":"b409043b6427a80c","repo":"GoogleContainerTools/skaffold","slug":"parsing-onbuild-instructions-w","errorCode":null,"errorMessage":"parsing ONBUILD instructions: %w","messagePattern":"parsing ONBUILD instructions: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/parse.go","lineNumber":398,"sourceCode":"\t\t\tfrom := fromInstruction(node)\n\n\t\t\t// onbuild should immediately follow the from command\n\t\t\texpandedNodes = append(expandedNodes, nodes[n:m+1]...)\n\t\t\tn = m + 1\n\n\t\t\tvar onbuildNodes []*parser.Node\n\t\t\tif ons, found := onbuildNodesCache[strings.ToLower(from.image)]; found {\n\t\t\t\tonbuildNodes = ons\n\t\t\t} else if from.image == \"\" {\n\t\t\t\t// some build args like artifact dependencies are not available until the first build sequence has completed.\n\t\t\t\t// skip check if there are unavailable images\n\t\t\t\tonbuildNodes = []*parser.Node{}\n\t\t\t} else if ons, err := parseOnbuild(ctx, from.image, cfg); err == nil {\n\t\t\t\tonbuildNodes = ons\n\t\t\t} else if warnMsg, ok, _ := isOldImageManifestProblem(cfg, err); ok && warnMsg != \"\" {\n\t\t\t\tlog.Entry(context.TODO()).Warn(warnMsg)\n\t\t\t} else if !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing ONBUILD instructions: %w\", err)\n\t\t\t}\n\n\t\t\t// Stage names are case insensitive\n\t\t\tonbuildNodesCache[strings.ToLower(from.as)] = nodes\n\t\t\tonbuildNodesCache[strings.ToLower(from.image)] = nodes\n\n\t\t\texpandedNodes = append(expandedNodes, onbuildNodes...)\n\t\t}\n\t}\n\texpandedNodes = append(expandedNodes, nodes[n:]...)\n\n\treturn expandedNodes, nil\n}\n\nfunc parseOnbuild(ctx context.Context, image string, cfg Config) ([]*parser.Node, error) {\n\tlog.Entry(context.TODO()).Tracef(\"Checking base image %s for ONBUILD triggers.\", image)\n\n\t// Image names are case SENSITIVE","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/parse.go#L380-L416","documentation":"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.","triggerScenarios":"Thrown at pkg/skaffold/docker/parse.go:398 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}