{"record":{"id":"700ae4ba58e45190","repo":"denoland/deno","slug":"invalid-pattern","errorCode":null,"errorMessage":"invalid pattern","messagePattern":"invalid pattern","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ext/node/polyfills/deps/minimatch.js","lineNumber":254,"sourceCode":"            }\n          }\n        }\n        return expansions;\n      }\n    }\n  }\n});\n\n// node_modules/.deno/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js\nvar require_assert_valid_pattern = __commonJS({\n  \"node_modules/.deno/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js\"(exports) {\n    \"use strict\";\n    Object.defineProperty(exports, \"__esModule\", { value: true });\n    exports.assertValidPattern = void 0;\n    var MAX_PATTERN_LENGTH = 1024 * 64;\n    var assertValidPattern = (pattern) => {\n      if (typeof pattern !== \"string\") {\n        throw new TypeError(\"invalid pattern\");\n      }\n      if (pattern.length > MAX_PATTERN_LENGTH) {\n        throw new TypeError(\"pattern is too long\");\n      }\n    };\n    exports.assertValidPattern = assertValidPattern;\n  }\n});\n\n// node_modules/.deno/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/brace-expressions.js\nvar require_brace_expressions = __commonJS({\n  \"node_modules/.deno/minimatch@10.2.5/node_modules/minimatch/dist/commonjs/brace-expressions.js\"(exports) {\n    \"use strict\";\n    Object.defineProperty(exports, \"__esModule\", { value: true });\n    exports.parseClass = void 0;\n    var posixClasses = {\n      \"[:alnum:]\": [\"\\\\p{L}\\\\p{Nl}\\\\p{Nd}\", true],\n      \"[:alpha:]\": [\"\\\\p{L}\\\\p{Nl}\", true],","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/ext/node/polyfills/deps/minimatch.js#L236-L272","documentation":"Deno bundles minimatch for glob matching inside its Node polyfills; assertValidPattern requires every pattern to be a string and throws a TypeError ('invalid pattern') before any parsing or matching starts. This mirrors upstream minimatch@10 behavior.","triggerScenarios":"Calling a glob/match API with a pattern variable that is undefined, null, a number, or a RegExp; forwarding values from JSON config or URL params into the pattern position without type checking.","commonSituations":"Optional config keys (include/exclude globs) that are absent in some environments; API boundaries where callers send non-strings; mixing RegExp (accepted by some matchers) with glob strings (required by minimatch).","solutions":["Default missing patterns: pattern ?? \"**/*\" or skip the call when absent","If you have multiple patterns, loop over them — never pass an array or other type where one string belongs","Stringify only genuinely textual values at the boundary, and reject the rest"],"exampleFix":"// before\nminimatch(\"src/a.ts\", cfg.include);\n// after\nminimatch(\"src/a.ts\", cfg.include ?? \"**/*\");","handlingStrategy":"type-guard","validationCode":"if (typeof pattern !== \"string\" || pattern === \"\") {\n  throw new TypeError(`glob pattern must be a non-empty string, got ${typeof pattern}`);\n}","typeGuard":"const isGlobPattern = (p) => typeof p === \"string\" && p.length > 0;","tryCatchPattern":"try { return minimatch(path, pattern); }\ncatch (e) {\n  if (e instanceof TypeError && e.message === \"invalid pattern\") {\n    return false; // no usable pattern -> no match\n  } else throw e;\n}","preventionTips":["Default optional glob config to '**/*' or skip the call when absent","Schema-validate config that contains globs","Never forward a RegExp where a glob string is expected"],"tags":["minimatch","glob","pattern","typeerror"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}