{"record":{"id":"71a5c43b5b6d4a03","repo":"kovidgoyal/kitty","slug":"s-is-not-a-valid-glob-pattern-with-error-w","errorCode":null,"errorMessage":"%s is not a valid glob pattern with error: %w","messagePattern":"(.+?) is not a valid glob pattern with error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/ssh/config.go","lineNumber":182,"sourceCode":"\t}\n\tans = []*EnvInstruction{ei}\n\treturn\n}\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 != \"\" {","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/ssh/config.go#L164-L200","documentation":"resolve_file_spec expands a copy-instruction file spec with doublestar.FilepathGlob when it contains glob metacharacters. If the pattern is malformed (e.g. unbalanced '['), doublestar returns an error which is wrapped with the spec.","triggerScenarios":"A copy: or env copy spec like '~/data/[a-' where the glob syntax itself is invalid.","commonSituations":"Windows-style paths with brackets, typos in character classes, or accidentally treating a literal filename containing '*' or '[' as a glob.","solutions":["Fix the glob pattern syntax (balanced brackets, valid character classes)","Escape literal metacharacters if the filename really contains them","Test the pattern with a glob tester before putting it in config"],"exampleFix":"// before\ncopy: ~/logs/[2024-\n// after\ncopy: ~/logs/2024-*","handlingStrategy":"validation","validationCode":"if _, err := doublestar.FilepathGlob(pattern); err != nil { /* reject pattern before config load */ }","typeGuard":"func isValidGlob(p string) bool { _, err := doublestar.FilepathGlob(p); return err == nil }","tryCatchPattern":null,"preventionTips":["Lint glob patterns in config during CI","Escape literal brackets/asterisks in filenames"],"tags":["glob","filesystem","config","ssh"],"backgroundTag":"invalid-glob-pattern","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}