{"record":{"id":"bc2063e63af57fd5","repo":"kovidgoyal/kitty","slug":"s-matches-no-files","errorCode":null,"errorMessage":"%s matches no files","messagePattern":"(.+?) matches no files","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/ssh/config.go","lineNumber":185,"sourceCode":"}\n\nvar paths_ctx *paths.Ctx\n\nfunc resolve_file_spec(spec string, is_glob bool) ([]string, error) {\n\tif paths_ctx == nil {\n\t\tpaths_ctx = &paths.Ctx{}\n\t}\n\tans := os.ExpandEnv(paths_ctx.ExpandHome(spec))\n\tif !filepath.IsAbs(ans) {\n\t\tans = paths_ctx.AbspathFromHome(ans)\n\t}\n\tif is_glob {\n\t\tfiles, err := doublestar.FilepathGlob(ans)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s is not a valid glob pattern with error: %w\", spec, err)\n\t\t}\n\t\tif len(files) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"%s matches no files\", spec)\n\t\t}\n\t\treturn files, nil\n\t}\n\terr := unix.Access(ans, unix.R_OK)\n\tif err != nil {\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\treturn nil, fmt.Errorf(\"%s does not exist\", spec)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Cannot read from: %s with error: %w\", spec, err)\n\t}\n\treturn []string{ans}, nil\n}\n\nfunc get_arcname(loc, dest, home string) (arcname string) {\n\tif dest != \"\" {\n\t\tarcname = dest\n\t} else {\n\t\tarcname = filepath.Clean(loc)","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/ssh/config.go#L167-L203","documentation":"When a glob file spec expands successfully but matches zero files, resolve_file_spec rejects it immediately rather than proceeding with an empty list. This guards copy instructions from silently copying nothing.","triggerScenarios":"A copy spec like '~/data/*.conf' where the directory exists but contains no matching files (or the pattern is too specific).","commonSituations":"Wrong home-directory assumption (paths are resolved via AbspathFromHome), typos in the pattern, or files not yet created at connect time.","solutions":["Verify the files exist under the resolved absolute path","Broaden the pattern or fix typos","If files are created later, ensure they exist before starting the ssh kitten"],"exampleFix":"// before\ncopy: ~/.config/app/*.yaml   # no yaml files present\n// after\ncopy: ~/.config/app/*","handlingStrategy":"validation","validationCode":"if files, _ := doublestar.FilepathGlob(pattern); len(files) == 0 { /* fail early with your own message */ }","typeGuard":"func globMatches(p string) bool { f, _ := doublestar.FilepathGlob(p); return len(f) > 0 }","tryCatchPattern":null,"preventionTips":["Check that files exist at connect time","Pre-resolve ~ to the correct home before matching"],"tags":["glob","filesystem","config","ssh"],"backgroundTag":"glob-matches-nothing","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}