{"record":{"id":"ef74b6aef6a6eb90","repo":"apple/pkl","slug":"invalidglobpattern-ef74b6","errorCode":"invalidGlobPattern","errorMessage":"invalidGlobPattern","messagePattern":"invalidGlobPattern","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java","lineNumber":1210,"sourceCode":"            .build();\n      }\n      var resolvedElements =\n          GlobResolver.resolveGlob(securityManager, globModuleKey, null, null, uriString);\n\n      var builder = new VmObjectBuilder(resolvedElements.size());\n      for (var entry : resolvedElements.entrySet()) {\n        var moduleKey = moduleResolver.resolve(entry.getValue().uri());\n        builder.addEntry(entry.getKey(), language.loadModule(moduleKey));\n      }\n      return builder.toMapping(resolvedElements);\n    } catch (IOException e) {\n      throw exceptionBuilder().evalError(\"ioErrorResolvingGlob\", importUri).withCause(e).build();\n    } catch (ExternalReaderProcessException e) {\n      throw exceptionBuilder().evalError(\"externalReaderFailure\").withCause(e).build();\n    } catch (SecurityManagerException e) {\n      throw exceptionBuilder().withCause(e).build();\n    } catch (InvalidGlobPatternException e) {\n      throw exceptionBuilder()\n          .evalError(\"invalidGlobPattern\", uriString)\n          .withHint(e.getMessage())\n          .build();\n    }\n  }\n\n  // endregion\n  // region utilities\n\n  private static @Nullable String exportNullableString(VmObjectLike value, Object key) {\n    var result = VmValue.export(VmUtils.readMember(value, key));\n    return result instanceof PNull ? null : (String) result;\n  }\n\n  /** Check a value and its parents to see if any assign/amend the given property */\n  private void checkPropertyIsUndefined(VmTyped value, Identifier name) {\n    var member = VmUtils.findMember(value, name);\n    if (member == null) return;","sourceCodeStart":1192,"sourceCodeEnd":1228,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java#L1192-L1228","documentation":"A glob import URI contained a malformed glob pattern. When GlobResolver rejects the pattern it throws InvalidGlobPatternException, which CommandSpecParser converts into an `invalidGlobPattern` eval error carrying the URI string plus the invalidity reason as a hint.","triggerScenarios":"import(\"glob:...\") with a pattern that the glob parser rejects — e.g. unbalanced brackets, an illegal `**` placement, or characters not permitted in the pattern syntax for the target scheme.","commonSituations":"Hand-writing glob patterns with typos like `[a-z` or `{` after a shell/regex conversion; patterns copied from a tool using different glob semantics; Windows path separators mixed into the pattern.","solutions":["Read the error hint — it states exactly what part of the pattern is invalid.","Fix the pattern syntax: balance [] and {}, use `**` only as a whole path segment, use forward slashes.","Test the pattern locally with a glob tool matching Pkl's syntax before adding it to config.","Escape literal special characters ([, ], {, }, *, ?) if they are meant literally."],"exampleFix":"// before\nx = import(\"glob:configs/[a-z/*.pkl\")\n\n// after\nx = import(\"glob:configs/[a-z]/*.pkl\")","handlingStrategy":"validation","validationCode":"// quick pattern sanity check before committing\n// balance of [], {}, and no stray '**/' misuse\nfunction looksLikeValidGlob(p) = p.countOf(\"[\") == p.countOf(\"]\") && p.countOf(\"{\") == p.countOf(\"}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Read the error hint; it names the invalid part of the pattern","Balance all bracket/brace characters and escape literals","Use forward slashes and keep `**` as full path segments","Test glob patterns with a matching-syntax tool before committing"],"tags":["pkl","glob","pattern","validation"],"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-14T16:17:12.679Z"}