apple/pkl · error · VmException

cannotGlobTripleDots

cannotGlobTripleDots

Error message

cannotGlobTripleDots

What it means

Glob imports (`import* "glob" as ...`) require a glob pattern, but the pattern cannot begin with `...` — triple-dot prefixes are reserved/relative-parent path syntax that has no meaning for glob matching. `doVisitImport` rejects such URIs before resolving.

Source

Thrown at pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java:755

  }

  @Override
  public TraceNode visitTraceExpr(TraceExpr expr) {
    return new TraceNode(createSourceSection(expr), visitExpr(expr.getExpr()));
  }

  @Override
  public AbstractImportNode visitImportExpr(ImportExpr expr) {
    var importUriCtx = expr.getImportStr();
    return doVisitImport(expr.isGlob(), expr, importUriCtx);
  }

  private AbstractImportNode doVisitImport(
      boolean isGlobImport, Node node, StringConstant importUriNode) {
    var section = createSourceSection(node);
    var importUri = importUriNode.getString();
    if (isGlobImport && importUri.startsWith("...")) {
      throw exceptionBuilder().evalError("cannotGlobTripleDots").withSourceSection(section).build();
    }
    var resolvedUri = resolveImport(importUri, importUriNode);
    if (isGlobImport) {
      return new ImportGlobNode(section, moduleInfo.getResolvedModuleKey(), resolvedUri, importUri);
    }
    return new ImportNode(language, section, moduleInfo.getResolvedModuleKey(), resolvedUri);
  }

  @Override
  public AbstractReadNode visitReadExpr(ReadExpr expr) {
    return switch (expr.getReadType()) {
      case READ ->
          ReadNodeGen.create(createSourceSection(expr), moduleKey, visitExpr(expr.getExpr()));
      case NULL ->
          ReadOrNullNodeGen.create(createSourceSection(expr), moduleKey, visitExpr(expr.getExpr()));
      case GLOB ->
          ReadGlobNodeGen.create(createSourceSection(expr), moduleKey, visitExpr(expr.getExpr()));
    };

View on GitHub (pinned to f3efcbfc9b)

Solutions

  1. Remove the leading `...` and use a valid glob pattern relative to the current module.
  2. Use the correct parent-directory syntax supported by Pkl glob imports (`../`) if importing from an ancestor directory.
  3. Restructure the project so the target modules are in or below the current module's directory.

Example fix

// before
import* ".../*.pkl" as mods
// after
import* "../*.pkl" as mods
Defensive patterns

Strategy: validation

Validate before calling

// Validate glob import URIs before rendering:
function isValidGlobUri(uri) {
  return typeof uri === 'string' && uri.length > 0 && !uri.startsWith('...');
}

Type guard

const isGlobSafe = (uri: string): boolean => !uri.startsWith('...');

Prevention

When it happens

Trigger: Writing `import* ".../*.pkl" as mods` — any glob import whose URI string starts with "...".

Common situations: Trying to import all modules from a parent directory by prefixing `...`, confusing Pkl's glob syntax with filesystem relative paths or other languages' import syntax.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08). Data as JSON: /api/errors/4de3318a159e26ca. Report an issue: GitHub.