{"record":{"id":"db30b90d9ccd2aed","repo":"GoogleContainerTools/skaffold","slug":"invalid-dockerfile-instruction-q","errorCode":null,"errorMessage":"invalid dockerfile instruction: %q","messagePattern":"invalid dockerfile instruction: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/parse.go","lineNumber":344,"sourceCode":"func readCopyCommand(value *parser.Node, envs []string, workdir string) (*copyCommand, error) {\n\t// If the --from flag is provided, we are dealing with a multi-stage dockerfile\n\t// Adding a dependency from a different stage does not imply a source dependency\n\tif hasMultiStageFlag(value.Flags) {\n\t\treturn nil, nil\n\t}\n\n\tvar paths []string\n\tslex := shell.NewLex('\\\\')\n\tfor value := value.Next; value != nil && !strings.HasPrefix(value.Value, \"#\"); value = value.Next {\n\t\tpath, _, err := slex.ProcessWord(value.Value, shell.EnvsFromSlice(envs))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"expanding src: %w\", err)\n\t\t}\n\n\t\tpaths = append(paths, path)\n\t}\n\tif len(paths) == 0 {\n\t\treturn nil, fmt.Errorf(\"invalid dockerfile instruction: %q\", value.Original)\n\t}\n\n\t// All paths are sources except the last one\n\tvar srcs []string\n\tfor _, src := range paths[0 : len(paths)-1] {\n\t\tif hasOneOfPrefixes(src, []string{\"http://\", \"https://\", \"<<\"}) {\n\t\t\tlog.Entry(context.TODO()).Debugln(\"Skipping watch on remote/heredoc dependency\", src)\n\t\t\tcontinue\n\t\t}\n\n\t\tsrcs = append(srcs, src)\n\t}\n\n\t// Destination is last\n\tdest := paths[len(paths)-1]\n\tdestIsDir := strings.HasSuffix(dest, \"/\") || path.Base(dest) == \".\" || path.Base(dest) == \"..\"\n\tdest = resolveDir(workdir, dest)\n","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/parse.go#L326-L362","documentation":"Fires in readCopyCommand when a COPY/ADD instruction in the Dockerfile has no source path arguments to expand (the node's value list is empty or only flags). The instruction is considered malformed because a valid COPY needs at least a src and dest.","triggerScenarios":"Thrown at pkg/skaffold/docker/parse.go:344 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the COPY/ADD instruction to include both source and destination arguments","Remove stray COPY instructions with missing arguments","Ensure multi-line/instruction continuation formatting is correct"],"exampleFix":null,"handlingStrategy":"validation","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"}