kovidgoyal/kitty · error

%s matches no files

Error message

%s matches no files

What it means

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.

Source

Thrown at kittens/ssh/config.go:185

}

var paths_ctx *paths.Ctx

func resolve_file_spec(spec string, is_glob bool) ([]string, error) {
	if paths_ctx == nil {
		paths_ctx = &paths.Ctx{}
	}
	ans := os.ExpandEnv(paths_ctx.ExpandHome(spec))
	if !filepath.IsAbs(ans) {
		ans = paths_ctx.AbspathFromHome(ans)
	}
	if is_glob {
		files, err := doublestar.FilepathGlob(ans)
		if err != nil {
			return nil, fmt.Errorf("%s is not a valid glob pattern with error: %w", spec, err)
		}
		if len(files) == 0 {
			return nil, fmt.Errorf("%s matches no files", spec)
		}
		return files, nil
	}
	err := unix.Access(ans, unix.R_OK)
	if err != nil {
		if errors.Is(err, os.ErrNotExist) {
			return nil, fmt.Errorf("%s does not exist", spec)
		}
		return nil, fmt.Errorf("Cannot read from: %s with error: %w", spec, err)
	}
	return []string{ans}, nil
}

func get_arcname(loc, dest, home string) (arcname string) {
	if dest != "" {
		arcname = dest
	} else {
		arcname = filepath.Clean(loc)

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Verify the files exist under the resolved absolute path
  2. Broaden the pattern or fix typos
  3. If files are created later, ensure they exist before starting the ssh kitten

Example fix

// before
copy: ~/.config/app/*.yaml   # no yaml files present
// after
copy: ~/.config/app/*
Defensive patterns

Strategy: validation

Validate before calling

if files, _ := doublestar.FilepathGlob(pattern); len(files) == 0 { /* fail early with your own message */ }

Type guard

func globMatches(p string) bool { f, _ := doublestar.FilepathGlob(p); return len(f) > 0 }

Prevention

When it happens

Trigger: A copy spec like '~/data/*.conf' where the directory exists but contains no matching files (or the pattern is too specific).

Common situations: Wrong home-directory assumption (paths are resolved via AbspathFromHome), typos in the pattern, or files not yet created at connect time.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/bc2063e63af57fd5. Report an issue: GitHub.