{"record":{"id":"66f17b50fd613870","repo":"kovidgoyal/kitty","slug":"specifying-a-remote-location-with-more-than-one-fi","errorCode":null,"errorMessage":"Specifying a remote location with more than one file is not supported","messagePattern":"Specifying a remote location with more than one file is not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kittens/ssh/config.go","lineNumber":239,"sourceCode":"\t\treturn nil, err\n\t}\n\topts, args, err := parse_copy_args(args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlocations := make([]string, 0, len(args))\n\tfor _, arg := range args {\n\t\tlocs, err := resolve_file_spec(arg, opts.Glob)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlocations = append(locations, locs...)\n\t}\n\tif len(locations) == 0 {\n\t\treturn nil, fmt.Errorf(\"No files to copy specified\")\n\t}\n\tif len(locations) > 1 && opts.Dest != \"\" {\n\t\treturn nil, fmt.Errorf(\"Specifying a remote location with more than one file is not supported\")\n\t}\n\thome := paths_ctx.HomePath()\n\tans = make([]*CopyInstruction, 0, len(locations))\n\tfor _, loc := range locations {\n\t\tci := CopyInstruction{local_path: loc, exclude_patterns: opts.Exclude}\n\t\tif opts.SymlinkStrategy != \"preserve\" {\n\t\t\tci.local_path, err = filepath.EvalSymlinks(loc)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Failed to resolve symlinks in %#v with error: %w\", loc, err)\n\t\t\t}\n\t\t}\n\t\tif opts.SymlinkStrategy == \"resolve\" {\n\t\t\tci.arcname = get_arcname(ci.local_path, opts.Dest, home)\n\t\t} else {\n\t\t\tci.arcname = get_arcname(loc, opts.Dest, home)\n\t\t}\n\t\tans = append(ans, &ci)\n\t}","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/ssh/config.go#L221-L257","documentation":"ParseCopyInstruction refuses to combine multiple source locations with an explicit destination arcname. When more than one file is resolved, the single destination name is ambiguous, so the kitten errors out rather than guessing.","triggerScenarios":"Passing multiple files plus a remote destination, e.g. 'file1 file2 remote:dest' or a wildcard expanding to >1 file together with opts.Dest set.","commonSituations":"Users assuming remote copy mirrors scp's multi-file semantics; wildcards that unexpectedly expand to several files; scripts templating a dest onto variable-length file lists.","solutions":["Drop the destination and let the kitten derive arcnames, or copy files one at a time","Use a single tar/archive source instead of multiple loose files","Double-check the glob isn't matching more than intended (quote and echo it)"],"exampleFix":"# before\nkitty +kitten ssh --copy \"a.txt b.txt myserver:archive.tar.gz\" user@host\n# after\nkitty +kitten ssh --copy a.txt user@host\nkitty +kitten ssh --copy b.txt user@host","handlingStrategy":"validation","validationCode":"expanded, _ := filepath.Glob(pattern)\nif len(expanded) > 1 && dest != \"\" {\n    // copy one-by-one or drop dest\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pair a multi-file glob with an explicit remote destination","Check expanded file count in wrappers before calling the kitten"],"tags":["ssh-kitten","copy","invalid-arguments"],"backgroundTag":"multiple-sources-single-destination","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}