{"record":{"id":"290c92f32e85a01f","repo":"apple/pkl","slug":"invalidglobpattern","errorCode":"invalidGlobPattern","errorMessage":"invalidGlobPattern","messagePattern":"invalidGlobPattern","errorType":"error_code","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/runtime/VmImportAnalyzer.java","lineNumber":127,"sourceCode":"                  theModuleKey,\n                  moduleKey,\n                  moduleKey.getUri(),\n                  entry.stringValue());\n          for (var globElement : elements.values()) {\n            var moduleUri = globElement.uri();\n            var mk = moduleResolver.resolve(moduleUri);\n            var rmk = mk.resolve(securityManager);\n            result.add(new ImportEntry(moduleUri, rmk));\n          }\n        } else {\n          var resolvedUri =\n              IoUtils.resolve(securityManager, moduleKey, IoUtils.toUri(entry.stringValue()));\n          var mKey = moduleResolver.resolve(resolvedUri);\n          var rmk = mKey.resolve(securityManager);\n          result.add(new ImportEntry(resolvedUri, rmk));\n        }\n      } catch (InvalidGlobPatternException e) {\n        throw new VmExceptionBuilder()\n            .evalError(\"invalidGlobPattern\", entry.stringValue())\n            .withSourceSection(entry.sourceSection())\n            .build();\n      } catch (FileNotFoundException | NoSuchFileException e) {\n        throw new VmExceptionBuilder()\n            .evalError(\"cannotFindModule\", entry.stringValue())\n            .withSourceSection(entry.sourceSection())\n            .build();\n      } catch (URISyntaxException e) {\n        throw new VmExceptionBuilder()\n            .evalError(\"invalidModuleUri\", entry.stringValue())\n            .withHint(e.getReason())\n            .withSourceSection(entry.sourceSection())\n            .build();\n      } catch (IOException e) {\n        throw new VmExceptionBuilder()\n            .evalError(\"ioErrorLoadingModule\", entry.stringValue())\n            .withCause(e)","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/runtime/VmImportAnalyzer.java#L109-L145","documentation":"A glob import (e.g. import(\"*.pkl\")) used a pattern that is invalid. The module resolver threw InvalidGlobPatternException, converted into invalidGlobPattern with the offending pattern and its source section.","triggerScenarios":"import() of a glob URI whose pattern violates glob rules (e.g. 'a**b' misuse, empty pattern, invalid special characters) during collectImports.","commonSituations":"Hand-written glob with misplaced '**'; escaping mistakes on Windows paths; patterns built programmatically that end up malformed.","solutions":["Correct the glob pattern at the reported source section (use valid globs like 'dir/*.pkl' or 'dir/**/*.pkl')","Avoid characters with special meaning unless intended; escape literals","If dynamic, validate the pattern before interpolating it into the import"],"exampleFix":"// before\nimport(\"src/**foo*.pkl\")\n// after\nimport(\"src/**/*.pkl\")","handlingStrategy":"validation","validationCode":"function validateGlob(p) { if (!p || /\\*\\*[^\\/]/.test(p)) throw new Error('invalid glob pattern: ' + p) }","typeGuard":"const isValidGlob = (p) => typeof p === 'string' && p.length > 0 && !/\\*\\*[^\\/]/.test(p);","tryCatchPattern":null,"preventionTips":["Use standard glob forms like '*.pkl' or '**/*.pkl'","Escape literal special characters","Validate interpolated patterns before importing"],"tags":["pkl","glob","import","pattern"],"backgroundTag":"invalid-regex-pattern","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}